• Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql

COSH Function in Oracle SQL – PLSQL

October 29, 2012 by techhoneyadmin

The COSH function in Oracle SQL / PLSQL is used to calculate hyperbolic cosine of numeric value where numeric value is provided in radian format.

It’s mathematically equal to COSH(N).

Syntax for the COSH function in Oracle SQL / PLSQL is:

SELECT COSH(radian)
FROM table_name;

Let’s take an example for understanding:

Suppose we want to get the hyperbolic cosine of 30 degree.

SELECT COSH(30*22/(7*180))
FROM dual;

The output of the above statement will be:

COSH(30*22/(7*180))
1.14035380553865

Notice that we have changed 30 degrees into radians while passing it in COSH function.


Filed Under: function Tagged With: cosh function in oracle plsql, cosh function in oracle sql, COSHPLSQL, how to use cosh function in oracle database query, how to use cosh function in oracle plsql, how to use cosh function in oracle sql, syntax and example of cosh function in oracle database query, syntax and example of cosh function in oracle plsql, syntax and example of cosh function in oracle sql, using cosh function in oracle database query, using cosh function in oracle plsql, using cosh function in oracle sql

COS Function in Oracle SQL – PLSQL

October 29, 2012 by techhoneyadmin

The COS function in Oracle SQL / PLSQL is used to calculate cosine of numeric value where numeric value is provided in radian format.

It’s mathematically equal to COS(N).

Syntax for the COS function in Oracle SQL / PLSQL is:

SELECT COS(radian)
FROM table_name;

Let’s take an example for understanding:
Suppose we want to get the cosine of 30 degree.

SELECT COS(30*22/(7*180))
FROM dual;

The output of the above statement will be:

COS(30*22/(7*180))
0.86592001044743

Notice that we have changed 30 degrees into radians while passing it in COS function.


Filed Under: function Tagged With: cos function in oracle plsql, cos function in oracle sql, COSPLSQL, how to use cos function in oracle database query, how to use cos function in oracle plsql, how to use cos function in oracle sql, syntax and example of cos function in oracle database query, syntax and example of cos function in oracle plsql, syntax and example of cos function in oracle sql, using cos function in oracle database query, using cos function in oracle plsql, using cos function in oracle sql

Oracle PL/SQL Primary Keys

October 29, 2012 by techhoneyadmin

Oracle PL/SQL PRIMARY KEY is single or group of column(s)/field(s) that can uniquely identify each record in a table.

An Oracle PL/SQL COMPOSITE PRIMARY KEY is the one which is made up of more than one fields or columns.

Important points about Oracle PL/SQL PRIMARY KEYS are:

  • A table can have one and only one PRIMARY KEY.
  • In Oracle SQL a PRIMARY KEY can be created by using maximum of 32 columns / fields.
  • The columns / fields that are used to define a PRIMARY KEY on table cannot have NULL values.
  • A PRIMARY KEY can be defined using CREATE TABLE or ALTER TABLE Statement.

Oracle PL/SQL PRIMARY KEY using CREATE TABLE Statement Syntax

CREATE TABLE table_name
   (column_name1 datatype NULL/NOT NULL
   ,column_name2 datatype NULL/NOT NULL
   ,column_name3 datatype NULL/NOT NULL
.
column_nameN datatype null/notnull
,CONSTRAINT constraint_name PRIMARY KEY (column_name1, column_name2, . , column_nameN );

Oracle PL/SQL PRIMARY KEY using ALTER TABLE Statement Syntax

ALTER TABLE table_name
ADD CONSTRAINT constraint_name PRIMARY KEY (column_name1,column_name2, . ,column_nameN);

Oracle PL/SQL PRIMARY KEY Examples

Oracle PL/SQL PRIMARY KEY – Using CREATE TABLE Statement

Suppose, we wish to create Oracle PL/SQL PRIMARY KEY constraint on ‘employee_id’ column of ‘employee’ table;

Employee_ID Employee_Name Salary Department Commission
101 Emp A 10000 Sales 10
102 Emp B 20000 IT 20
103 Emp C 28000 IT 20
104 Emp D 30000 Support
105 Emp E 32000 Sales 10

Below CREATE TABLE Statement will define Oracle PL/SQL PRIMARY KEY on ‘employee’ table with “employee_id’ as PRIMARY KEY


CREATE TABLE employee
(employee_id        NUMBER(10)       NOT NULL
,employee_name      VARCHAR2(500)    NOT NULL
,salary             NUMBER(20)       NOT NULL
,department         VARCHAR2(300)    NOT NULL
,commission         NUMBER(20)
,constraint employee_pk PRIMARY KEY (employee_id);

Here with the help of the above SQL CREATE statement we have created a table named ‘employee’ that has 5 columns namely ‘employee_id’, ‘employee_name’, ‘department’, ‘salary’ and ‘commission’.  Also we are having the ‘employee_id’ column as the primary key for the ‘employee’ table.

In the above Oracle PL/SQL PRIMARY KEY example the SQL CREATE TABLE Statement will create a new table named ‘employee’ having a PRIMARY KEY on ‘employee_id’ column.

Let’s insert some data in the ‘employee’ table.


insert into employee
values (101,'Emp A',10000,'Sales',10);

insert into employee
values (102,'Emp B',20000,’IT’,20);

insert into employee
values (103,'Emp C',28000,'IT',20);

insert into employee
values (104,'Emp D',30000,'Support',NULL);

insert into employee
values (105,'Emp E',32000,'Sales',10);

The above SQL INSERT Statements will insert 5 rows in the ‘employee’ table.

Now, if we query the employee table as:

SELECT *
FROM employee;

We will get the following result:

Employee_ID Employee_Name Salary Department Commission
101 Emp A 10000 Sales 10
102 Emp B 20000 IT 20
103 Emp C 28000 IT 20
104 Emp D 30000 Support
105 Emp E 32000 Sales 10

Here we have successfully created ‘employee’ table with ‘employee_id’ as PRIMARY KEY and also inserted data in ‘employee’ table.

If we try to insert one more record of employee_id = 105 as:

insert into employee
values (105,'Emp F',40000,'Sales',30);

We get an error that unique constraint is getting violated and the data cannot be entered, this is because ‘employee_id’ is the primary key and for employee _id = 105 we already have a record in ‘employee’ table and hence one more record of the same key cannot be entered.


Oracle PL/SQL PRIMARY KEY – Using ALTER TABLE Statement

Suppose we have not created any Oracle PL/SQL PRIMARY KEY on ‘employee’ table earlier .

We can use the SQL ALTER TABLE Statement to define a new PRIMARY KEY on employee table.

For example, the below SQL ALTER TABLE Statement will create PRIMARY KEY on ‘employee_id’ column of employee table.

ALTER TABLE employee
ADD CONSTRAINT employee_pk PRIMARY KEY (employee_id);

We can always DROP, DISABLE and ENABLE an Oracle PL/SQL PRIMARY KEY.


Filed Under: sql Tagged With: : primary key in oracle plsql, CREATETABLEPLSQL, how to use primary key in oracle database query, how to use primary key in oracle plsql, how to use primary key in oracle sql, primary key in oracle sql, PRIMARYKEYPLSQL, syntax and example of primary key in oracle database query, syntax and example of primary key in oracle plsql, syntax and example of primary key in oracle sql, using primary key in oracle database query, using primary key in oracle plsql, using primary key in oracle sql

SEQUENCE in Oracle SQL – PLSQL

October 29, 2012 by techhoneyadmin

In Oracle SQL /PLSQL whenever we want to create an auto-number field we use SEQUENCE. A SEQUENCE is used to generate number sequences in Oracle SQL.
Sequences are very useful whenever we want to create a unique number that can act as a primary key for a table.

Syntax for creation of a SEQUENCE in Oracle SQL / PLSQL is:

CREATE SEQUENCE sequence_name
MINVALUE value
MAXVALUE value
START WITH value
INCREMENT BY value
CACHE value;

Let’s understand each line of the above SQL CREATE SEQUENCE command:

MINVALUE: is the minimum value that the sequence can have.
MAXVALUE: is the maximum value up to which the sequence will go. The maximum value allowed is 999999999999999999999999999. If we omit the MAXVALUE portion from the CREATE SEQUENCE command then the MAXVALUE is defaulted to 999999999999999999999999999
START WITH: is the value where the SEQUENCE starts from. The start value must be greater than or equal to MINVALUE.
INCREMENT BY: is the value by which the current value of the sequence is incremented to get the next value of the sequence.
CACHE: Represents the number of values that the sequence will have in cache for better performance.

Let’s take an example for understanding

Suppose have a table named ‘employee’ in the database as shown below, but we do not have any data in the table.

Employee_Id Employee_Name Salary Department Commission

Let’s create a SEQUENCE and the use it to enter data in ‘employee’ table.

Step 1: Creating a SEQUENCE:

CREATE SEQUENCE employee_seq
MINVALUE 100
MAXVALUE 999999999999999999999999999
START WITH 101
INCREMENT BY 1
CACHE 30;

Here with the help of the above SQL CREATE SEQUENCE command we have created a sequence named ‘employee_seq’ that starts with 101 and can go up to 999999999999999999999999999, it will increment with 1 value at a time and caching up to 30 values for performance.


Step 2: Inserting the data in the ‘employee’ table using the ‘employee_seq’ sequence in ‘employee_id’ field.

INSERT INTO employee
VALUES (employee_seq.nextval,'Emp A',10000,'Sales',10);

INSERT INTO employee
VALUES (employee_seq.nextval,'Emp B',20000,'IT',20);

INSERT INTO employee
VALUES (employee_seq.nextval,'Emp C',28000,'IT',20);

INSERT INTO employee
VALUES (employee_seq.nextval,'Emp D',30000,'Support',NULL);

INSERT INTO employee
VALUES (employee_seq.nextval,'Emp E',32000,'Sales',10);

The above SQL INSERT statement will insert 5 rows in the ‘employee’ table.
Note the in all the above SQL INSERT statements we have used employee_seq.netxval to get the next value for the employee_id field.

Now, if we query the employee table as:

SELECT *
FROM employee;

We will get the following result:

Employee_Id Employee_Name Salary Department Commission
101 Emp A 10000 Sales 10
102 Emp B 20000 IT 20
103 Emp C 28000 IT 20
104 Emp D 30000 Support
105 Emp E 32000 Sales 10

Here we have successfully inserted data in ‘employee’ table using sequence ‘employee_seq’ for the ‘employee_id’ field.


Filed Under: statement Tagged With: how to use sequence in oracle database query, how to use sequence in oracle plsql, how to use sequence in oracle sql, sequence in oracle plsql, sequence in oracle sql, SEQUENCEPLSQL, syntax and example of sequence in oracle database query, syntax and example of sequence in oracle plsql, syntax and example of sequence in oracle sql, using sequence in oracle database query, using sequence in oracle plsql, using sequence in oracle sql

Important Properties of Advanced Table

October 28, 2012 by techhoneyadmin

ID (mandatory) – You have to give an id to the advanced table region. This id will uniquely define the advanced table on that page.

View Instance (mandatory) – Enter the instance name of the VO on which your advanced table should be based.

Note: you cannot have two advanced table on the same page based on the same VO, until and unless the advanced tables that you are creating are view only and don’t have the capability of any type of form submission. The reason for this is that once a table action is perform on one table the corresponding VO state will be changed, hence changing the state of the other advanced table based on the same VO.

Text – you can specify any text that will appear on the top of the table.

Additional Text – you can specify any additional text that will appear once the table is rendered on the page.

Records Displayed – Now this is an important property, by default the value of this property is 10. Hence once your table has some, say 15 records to display then it will show only 10 records at once and to see the next 5 records you have to click on the “next” navigation link that comes by default on the top of the table. If you set the value to 15 the all the 15 records will be displayed at once on to the screen.

Width – This is another important property of the advanced table. Using this property you can set the width of the table on the OA Framework page once the page is displayed. Now, you can choose to enter the width of the advanced table in pixels or even in percentage. To enter the width of the table in pixels just enter a numeric value e.g. 500 or 600, once the page is displayed the width of the advanced table will be 500 or 600 pixels as entered by you. In order to enter the width of the table in percentage you just have to enter a value like 70% or 80%, now when the page is rendered the width of the table will be 70% or 80 % of the total page. Once you set the width of the table to 100% the “next” and “previous” navigation links will be displayed on top of the table. These navigation links allow to browse through other rows of the table.

Empty table text – you can define a text message that will appear if the table does not have any records to display. If nothing has been specified and the table has not been queried the “ No Search Conducted” will be displayed, but if a query has been conducted and no records were found then “No Data Exists” will be displayed.

Branding Type – Advanced table branding means that you can give a look to the table. OA Framework proved three options to brand the table.

  1. rowBranding
  2. columnBranding
  3. noBranding

By default “noBranding” option will be active.

Row Branding: Once you set the branding style in the property palette of advancedTable region and run the page, you will note that the alternative rows of the table are in grey bands of color. Even you have the option to choose the branding interval, by default the branding interval is 1 and hence alternative row is displayed in grey brand color, if you choose 2 as branding interval then the grey band row will appear after every 2 rows.

Column Branding: This is similar to row banding except that now rather that rows the columns of your advanced table will be in the grey band branding style.

No Branding: This is the default branding style that’s selected if you don’t choose other styles, in this style neither rows nor columns will be branded and all the rows and tables of the advanced table will be displayed as mentioned in Oracle BLAF.

Banding Interval – As discussed above this is the property to set the interval of the branding. By default the value will be 1.

Controller Class – If you want to have some runtime control on the advanced table then only you need to enter the controller class property for the table.

Admin Personalization – True if you want the admin to be able to personalize the region else false.

User Personalization – True if you want the user to be able to personalize the region else false.

Filed Under: Regions Tagged With: advancedTable, branding, OAAdvancedTableBean, properties of advancedTable, records displyed

  • « Go to Previous Page
  • Page 1
  • Interim pages omitted …
  • Page 49
  • Page 50
  • Page 51
  • Page 52
  • Page 53
  • Interim pages omitted …
  • Page 76
  • Go to Next Page »

Copyright © 2025 · Parallax Pro on Genesis Framework · WordPress · Log in