31 July 2008

SQL : TABLE DATA TYPE INTO Records

Here is the another new technique which I found in ORACLE sql today.

Following SQL helps to convert the SQL TABLEDATA type in to Rows.
SELECT * FROM THE
(SELECT str2tbl(str)
FROM DUAL)

str2tbl -- Procedure converts ; separated String into table.

CREATE OR REPLACE FUNCTION APPS.str2tbl( p_str IN VARCHAR2 ) return SRRDTABLETYPE
AS
l_str LONG DEFAULT p_str ';';
l_n NUMBER;
l_data SRRDTABLETYPE := SRRDTABLETYPE();
BEGIN
LOOP
l_n := INSTR( l_str, ';' );
EXIT WHEN (NVL(l_n,0) = 0);
l_data.extend;
l_data( l_data.count ) := LTRIM(RTRIM(SUBSTR(l_str,1,l_n-1)));
l_str := SUBSTR( l_str, l_n+1 );
end LOOP;
RETURN l_data;
END;
/
This helps us to write SQL for tabledata types.

18 July 2008

Address - Chicago

http://www.saisamsthanusa.org/
Shiridi Temple -- Chicago
1101 Foran Lane Aurora, IL-60506, USA


http://www.balaji.org/

Sri Venkateswara Swami Temple of greater Chicago
1145 W. Sullivan Rd
Aurora, IL 60506

15 July 2008

Oracle Apps/SQL: MERGE Statement

Oracle9i introduces a new set of server functionality especially beneficial for the ETL (Extraction, Transformation, and Loading) part of any Business Intelligence process flow, addressing all the needs of highly scalable data transformation inside the database.
One of the most exciting new features addressing the needs for ETL is the SQL statement MERGE. The new SQL combines the sequence of conditional INSERT and UPDATE commands in a single atomic statement, depending on the existence of a record. This operation is commonly known as Upsert functionality.

MERGE INTO USING ON ()WHEN MATCHED THEN DELETE WHEN NOT MATCHED THEN [LOG ERRORS ]; CREATE TABLE employee (employee_id NUMBER(5),first_name VARCHAR2(20),last_name VARCHAR2(20),dept_no NUMBER(2),salary NUMBER(10));
INSERT INTO employee VALUES (1, 'Dan', 'Morgan', 10, 100000);INSERT INTO employee VALUES (2, 'Jack', 'Cline', 20, 100000);INSERT INTO employee VALUES (3, 'Helen', 'Lofstrom', 20, 50000);INSERT INTO employee VALUES (4, 'Jackie', 'Stough', 20, 40000);INSERT INTO employee VALUES (5, 'Richard', 'Foote', 20, 70000);INSERT INTO employee VALUES (6, 'Joe', 'Johnson', 20, 30000);INSERT INTO employee VALUES (7, 'Clark', 'Urling', 20, 90000);
CREATE TABLE bonuses (employee_id NUMBER, bonus NUMBER DEFAULT 100);
INSERT INTO bonuses (employee_id) VALUES (1);INSERT INTO bonuses (employee_id) VALUES (2);INSERT INTO bonuses (employee_id) VALUES (4);INSERT INTO bonuses (employee_id) VALUES (6);INSERT INTO bonuses (employee_id) VALUES (7);COMMIT;
SELECT * FROM employee;
SELECT * FROM bonuses;
MERGE INTO bonuses bUSING ( SELECT employee_id, salary, dept_no FROM employee WHERE dept_no =20) eON (b.employee_id = e.employee_id)WHEN MATCHED THEN UPDATE SET b.bonus = e.salary * 0.1 DELETE WHERE (e.salary <> 40000);
SELECT * FROM bonuses;

25 June 2008

Examine Password Enable/Disable.

Set Utilities:Diagnostics Profile value to Yes/No to disable/enable password to use the examine feature in Oracle Apps.

Remove non ASCII Characters from a string

It's simple .....

SQL is here

SELECT
REPLACE(TRANSLATE(UPPER('YOUR_STRING'),
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ,./;''[]\`~!@#$%^\*()__+{}-?><', '0123456789' ), ' ', '') FROM DUAL; Is it useful .. enSoy madi

SP for removing Specail characters

v_nam := replace(v_nam,'''');

v_nam := replace(v_nam,';');

v_nam := utl_i18n.escape_reference(v_nam,'us7ascii');

DECLARE

v_pos1 NUMBER;

v_pos2 NUMBER;

v_pointer NUMBER;

BEGIN

v_pointer :=1;

LOOP

v_pos1:=0;

v_pos2:=0;

v_pos1 :=INSTR(v_nam,'&',v_pointer);

v_pos2 :=INSTR(v_nam,';',v_pointer);

EXIT WHEN v_pointer > 360 OR v_pos1 =0 OR v_pos2 = 0; --Party Name max size is 360; v_nam := SUBSTR(v_nam,1,v_pos1-1)SUBSTR(v_nam,v_pos2+1);

v_pointer:= v_pos2+1;

END LOOP;

END;

24 June 2008

How to display Html Tags in Blogs

Replace < symbol with & l t ;
Replace > symbol with & g t ;
Replace " symbol with & q u o t ;
Add <br/> end of each line

in your text that's it it :-)
Note : Remove spaces between &-;





Visit http://www.plus2net.com/html_tutorial/tags-page.php for online convertor

Trace for a specific user in Oracle APPS

Oracle Applications Trace for a specific user. This describes the method for running a trace for a specific user in Oracle application. The Oracle Applications modules impacted are the JTF Framework packages like iSupport, iSupplier etc. This method enables us to trace self service applications and debug user specific error logging issues.
How to create a Database Trace for a specific user.
This is to explain how to to create a database trace for a specific user. This process can be used to trace any action, anywhere in Oracle Applications and be very useful for the Self-Service Web Applications as there is no utility defined like in the Forms.
a. First make sure the necessary profile has the proper permissions. 1. Log onto the Applications Forms with the Application Developer Responsibility 2. Navigate to the Profile menu 3. Query up the profile name "FND_INIT_SQL" 4. In the bottom block of the form, make sure that ALL checkboxes are checked
Typically, you will have to enable the checkboxes under "User Access" to make it "Visible" and "Updatable".
b. Now switch to the System Administrator Responsibility
1. Navigate to - Profile - System 2. On the "Find System Profile Values" form, make sure the checkboxes for "User" and "Profiles with no Values" are checked 3. Beside the "User" checkbox, use the LOV to select the user who's activity you need to trace 4. In the "Profile" field, enter the following profile and click the button: 'Initialization SQL Statement - Custom' 5. In the "System Profile Values" form, enter the following in the User Field: (This is one line and all single quotes)
begin fnd_ctl.fnd_sess_ctl('','','TRUE','TRUE','LOG','ALTER SESSION SET EVENTS=''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12'' tracefile_identifier=''OracleSupport'''); end;
6. DO NOT SAVE THE PROFILE YET
7. In another browser window, login as the user you are going to trace and prepare to reproduce the problem 8. Once you are ready to reproduce the problem, go back to the Applications Forms and Save the profile change 9. Reproduce the problem 10. Back in the Applications form, set profile to null so it does not trace anymore and Save the change 11. The trace will be located in the user_dump_dest. To find location run the following in SQL*Plus: select value from v$parameter where name = 'user_dump_dest'; 12. The trace file will have current date/time and can be identified with the word OracleSupport in it.