Sunday, May 11, 2008

Synonyms - Oracle

Synonyms

 

 

Simplify access to objects by creating a synonym (another name for an object). With synonyms, you can:

 

Ease referring to a table owned by another user

Shorten lengthy object names

 

Query syntax

 

CREATE [PUBLIC] SYNONYM synonym

FOR object;

Eg:

CREATE PUBLIC SYNONYM dept

FOR alice.departments;

 

Thursday, May 8, 2008

To find out Date, Time and Characterset format of Oracle server.

To find out Date, Time and Characterset format of Oracle server.

 

 

select * from v$nls_parameters;

 

 

 

 

NLS_LANGUAGE                                                     AMERICAN                                                        

NLS_TERRITORY                                                    AMERICA                                                          

NLS_CURRENCY                                                     $                                                               

NLS_ISO_CURRENCY                                                 AMERICA                                                          

NLS_NUMERIC_CHARACTERS                                           .,                                                              

NLS_CALENDAR                                                     GREGORIAN                                                        

NLS_DATE_FORMAT                                                  DD-MON-RR                                                       

NLS_DATE_LANGUAGE                                                AMERICAN                                                        

NLS_CHARACTERSET                                                 UTF8                                                            

NLS_SORT                                                         BINARY                                                          

NLS_TIME_FORMAT                                                  HH.MI.SSXFF AM                                                  

NLS_TIMESTAMP_FORMAT                                             DD-MON-RR HH.MI.SSXFF AM                                        

NLS_TIME_TZ_FORMAT                                               HH.MI.SSXFF AM TZR                                              

NLS_TIMESTAMP_TZ_FORMAT                                          DD-MON-RR HH.MI.SSXFF AM TZR                                    

NLS_DUAL_CURRENCY                                                $                                                               

NLS_NCHAR_CHARACTERSET                                           AL16UTF16                                                       

NLS_COMP                                                         BINARY                                                          

NLS_LENGTH_SEMANTICS                                             BYTE                                                            

NLS_NCHAR_CONV_EXCP                                              FALSE                                                           

 

Wednesday, May 7, 2008

formdef.plugin.util.FormUtils-------Automating Conversion from Action Form to Java Business Objects/Value Objects

FormUtils.setFormValues()


   
FormUtils.setFormValues() can be used to initialize a form bean with values from a business object:

    DynaActionForm dynaForm = (DynaActionForm) 
            FormDefUtil.setFormValues("employeeForm", employee,
                    this, mapping, request);
            

The first parameter identifies the form definition that will be used.
The second parameter is the business object which contains the values that will be used to populate the form bean.
The last three parameters are the current Action object, the current action mapping, and the request being processed.

FormUtils.setFormValues() returns the populated form bean. This can then be placed by the caller in the proper scope with the proper name so that Struts can find it when rendering an HTML form.

 

  FormUtils.getFormValues()


   
FormUtils.getFormValues() can be used to create a populated business object from a form bean:

    Employee employee = (Employee)
            FormDefUtil.getFormValues(form, this, mapping, request);
            

The first parameter is the form passed by Struts to the action object.
The next three parameters are the current Action object, the current action mapping, and the request being processed.

getFormValues() returns the business object populated with values from the form bean. If a factory is associated with the form definition, it is called to create the business object that will be populated. Otherwise, the business object's no-arg constructor will be used to create the object.

What is a foreign key?

What is a foreign key?

A foreign key means that values in one table must also appear in another table.

The referenced table is called the parent table while the table with the foreign key is called the child table. The foreign key in the child table will generally reference a primary key in the parent table.

A foreign key can be defined in either a CREATE TABLE statement or an ALTER TABLE statement.

 

Using a CREATE TABLE statement

The syntax for creating a foreign key using a CREATE TABLE statement is:

CREATE TABLE table_name
(column1 datatype null/not null,
column2 datatype null/not null,
...
CONSTRAINT fk_column
  FOREIGN KEY (column1, column2, ... column_n)
  REFERENCES parent_table (column1, column2, ... column_n)
);

 

For example:

CREATE TABLE supplier

(

supplier_id

numeric(10)

not null,

 

supplier_name

varchar2(50)

not null,

 

contact_name

varchar2(50),

 

 

CONSTRAINT supplier_pk PRIMARY KEY (supplier_id)

);

 

CREATE TABLE products

(

product_id

numeric(10)

not null,

 

supplier_id

numeric(10)

not null,

 

CONSTRAINT fk_supplier

 

  FOREIGN KEY (supplier_id)

 

  REFERENCES supplier(supplier_id)

);

In this example, we've created a primary key on the supplier table called supplier_pk. It consists of only one field - the supplier_id field. Then we've created a foreign key called fk_supplier on the products table that references the supplier table based on the supplier_id field.

Putting text on the status bar

Putting text on the status bar

example demonstrates how to manipulate text on the status bar. When you move the cursor over a hyperlink, the statusbar shows the destination URL. This is not very helpful. Fortunately, it is very easy to put our own brief description there.

The normal HTML code for a hyperlink might be something like this:

<A HREF="mylink.htm">Click here</A>

To display something on the status bar when the mouse is moved over this link, you need to add a little more:

<A HREF="mylink.htm" onMouseOver="window.status='Click
here to know more about me'; return true;" onMouseOut="window.status=''; ">Click here</A>

 

Monday, May 5, 2008

Simple query to find out the version of Oracle..

Simple query to find out the version of Oracle..

Select * from v$version;

what is Oracle Schema

Schema

 

 

A schema is a collection of objects, such as tables, views, database user and has the same name as that user.

 

 

Check this link for more info

http://www.oracle.com/technology/obe/2day_dba/schema/schema.htm#t1