Thursday, May 20, 2010

Change the Prompt

How do you change the prompt in SQL PLUS

set sqlprompt "&&prompt_dbname> "
or
set sqlprompt &prompt_dbname>

This will prompt you to enter the DB Name

Enter value for prompt_dbname: MyOracleDB
MyOracleDB>

With the above step you will have to repeat this every time you log in; But how do you avoid that?
When you are using multiple database instances you may get lost where and which database you are in: It is always a good idea to have the SQL Prompt to say what you are connected to. To do this:

Step 1: Create a new file called “login.sql” in the same folder as sqlplusw.exe resides

Step 2: Copy the below content into the “login.sql” file

column user_sid new_value sql_prompt
select lower(user) || '@' || '&_CONNECT_IDENTIFIER' user_sid from dual;
set sqlprompt '&sql_prompt> '
clear screen;
set serveroutput on;

There you go, Now everytime you log in you would see the user and Prompt

scott@MyOracleDB>

 

Tuesday, May 18, 2010

Oracle Forms - Visual Attribute Vs Property Class

What is a Visual Attribute


Visual attributes are the font, color, and pattern properties that you set for form and menu objects that appear in your application's interface. Visual attributes can include the following properties:
Font properties: Font Name, Font Size, Font Style, Font Width, Font Weight
Color and pattern properties: Foreground Color, Background Color, Fill Pattern

What is a Property Class

This object is a named object that contains a list of properties and their associated settings. Once you create a property class you can base other objects on it. An object based on a property class can inherit the settings of any property in the class that is appropriate for that object.


Diff. between Visual Attribute and Property Class?

Named visual attributes define only font, color, and pattern attributes; property classes can contain these and any other properties.

You can change the appearance of objects at runtime by changing the named visual attribute programmatically; property class assignment cannot be changed programmatically. When an object is inheriting from both a property class and a named visual attribute, the named visual attribute settings take precedence, and any visual attribute properties in the class are ignored.