FREQUENTLY ASKED QUERIES

SQL QUERY BANK

1. Difference between DCL and DML commands?

DCL commands will commit implicitly where in DML commands we have to commit explicitly.

2. Table, Rowid, Rownum

Table is a database object, which is having more than one column associated with its data type.

Rowid is the unique binary address of the row in a table Rownum it is a temporary number in a memory and was assigned to each           row selected by the statement.

3. Pseudo-Columns

Columns that are not created explicitly by the user and can be used explicitly in queries. The pseudo-Columns are rowid, rownum, currval, nextval, sysdate, and level

4. What is a View?

View is Virtual Table, which hold the data at runtime

5. Difference between ordinary view and complex view?

Simple views can be modified easily and these cant hold the data where as complex views cant be modified directly and complex view can hold the data to modify a complex view we have to use INSTEAD OF TRIGGERS.

6. Forced view

Creating a view on a table, which is not there in the database.

7. Inline view

Inline view is basically a subquery with an alias that you can use like a view inside a SQL statement.

8. What is an INDEX and what are the types?

INDEX is a database object used in oracle to provide quick access to rows.

9. Synonym

Synonym is an alias name for any database object like tables, views, functions, procedures.

10.SELECT statement syntax?

SELECT <Column name>

From <table name>

Where <condition>

Having <statement>

Group by <column name>

Connect prior

11.What is Constraint? Different Constraints?

Constraints are representators of the columns to enforce data entity and consistency. UNIQUE, NOT NULL, Primary key, foreign key, Check.

12.Difference between Primary key and Unique + Not Null constraints?

Unique + Not Null is a combination of two constraints and we can use more than one Unique + Not Null in any table. Primary Key is a single constraint we can use only one time for a table. It can be a referential key for any column in any table.

13.What is NULL?

Default Value.

14.Dual Table

It is a one row, one column table with value X.

15.Difference between Truncate and Delete?

Truncate will delete all the rows from the table with out any condition. It will commit automatically when it fires Where delete will delete all or specified rows based upon the condition here we have to commit explicitly.

16.Difference between Char and Varchar2?

Varchar2 is similar to char but can store available number of characters and while querying the table varchar2 will trims the extra spaces and fetches the rows that exactly match the criteria.

17.Difference between LOB and LONG data types?

The maximum size of an LOB is 4GB. It will support random access to data where in LONG maximum size is 2GB. It will support sequential access to data.

18.Single Row functions: It will work on single row and give result for all the rows.

Ex: to_char, to_date etc.

19.Group Functions:

It will work on group of rows in a table and gives a single row result. Ex: Sum(), Avg(), min(), max().. Etc.

20.String Handling Functions?

Instr – it returns the position of the string where it occur according to the parameters.

Instrb – instr and instrb returns same but in the form of bytes.

Substr – It returns the portion of a string depending on the parameters from and to.

Substrb – Substr and Substrb returns the same thing but Substrb returns in the form of bytes

21.Sign:

Sign is a function it will take numbers, as inputs and it will give

i. 1 for positive integer

ii. -1 for negative integer

iii. 0 for ZERO

SQL> Select sign(-1234) from dual; O/P: -1

22.Differences between UNION and UNION ALL?

Union: The values of the first query are returned with the values of the second query eliminating the duplicates.

Union All: The values of the first query are returned with the values of the second query including the duplicates.

23.Difference between NVL and NVL2 functions?

NVL is used to fill a NULL value to known value. NVL2 will identify the NULL values and Filled values it returns exp3 if it is null otherwise it returns exp2. We have to pass 3 parameters for NVL2 and 2 parameters for NVL.

24.How can we compare range of values with out using the CASE?

By using Decode with in Decode.

25.Can we Decode with in a Decode?

YES

26.Decode and Case Difference?

Case compares a Range of values and Decode will work as if else statement.

27.Difference between Replace and Translate?

Replace is used to replace the whole string and we can pass null values in replace. Translate is used to translate character-by-character here we have to pass the three parameters.

28.Difference between where and having clause?

Where used to specify condition and used to restrict the data. Having used to specify the condition on grouped results and used to filter the data.

29.Difference between IN and EXISTS clause?

EXISTS gives the status of the inner query. If the inner query is success then it returns true other wise it returns false and IN will compare the list of values.

30.Difference between subquery and correlated subquery?

Query with in a query is subquery. Inner query will executes first and based on the result the outer query will be displayed. Correlated subquery outer query will executes first and then inner query will be executed.

31. What is EXPLAIN PLAN? Syntax?

Explain plan gives the execution plan of the statement. For using this explain plan we have the plan_table in the database.

Syntax: SQL> Explain plan

Set statemet_id = ‘xyx’

[Into plan_table]

for

DML STATEMENTS;

32.SQL TRACE Definition, Process and Query to get the Trace file path?

SQL trace gives the wide range of information and statistics that used to tune a group of SQL operations. To get the trace file we have to follow some steps

 Enable the Trace.

 Run DML statements.

 Disable the Trace.

 Convert the Trace file into readable format using the TKPROF.

Trace file Path: SQL> select value from v$parameter Where Name = ‘user_dump_dest’;

33.PL/SQL Block structure?

DECLARE

Variable declarations;

BEGIN

Statements;

Exception

Exception block;

END;

34.Anonymous Block?

It is a PL/SQL block with no name and set of statements and cannot be stored in the database.

35.Procedure and Function Differences?

The procedure may or may not return a value. It will return the values by its own name and function must and should return a value and it will return values with function name.

36.Package procedure and Procedure differences?

The package procedure is faster than the ordinary procedure because if we call the package in a procedure it will load into the SGA memory and then it starts functioning. The ordinary procedures use this SGA memory at runtime only.

37.Global Variable?

Declaring the variable in the package specification is the Global variable.

38.Triggers and Procedures differences?

Triggers is a database object which will fire implicitly when the event occur and TCL command will not work in the triggers by using the PRAGMA AUTONOMOUS TRANSACTION only we can use the TCL commands in triggers. Procedure is a database object where we have to raise explicitly and TCL commands will work in the Procedures.

39.Dynamic SQL?

If we want to do DML and DDL operations in the PL/SQL block we use this dynamic SQL. Two types are there in the Dynamic SQL

DBMS_SQL Execute immediate

40.Difference between DBMS_SQL and execute immediate?

DBMS_SQL is slower process when compare to execute immediate because in the DBMS_SQL we have to open, parse, fetch and execute to do the DML operations. It is the version of 7.3. Execute immediate is earlier version 9i it is a one step process used to execute fastly.

41.Define a Cursor, Types and its attributes?

Cursor is a private SQL area provided by the oracle engine its main use is to fetch more than one row.

                     Implicit

                    Explicit

Implicit cursor rises whenever we use DML statements in the PL/SQL block. User does not have control over it

Explicit cursor used to process select statement, which is used to retrieve more than one row. We have to open, fetch, close the cursor manually. User has control over it.

Cursor Attributes:

%ROWCOUNT – It returns the integer that how many rows that previous fetch returns.

%FOUND – It returns TRUE if the previous fetch returns a row otherwise FALSE.

%NOTFOUND – It returns FALSE if the previous fetch returns a row otherwise TRUE.

%ISOPEN – It returns TRUE if the named cursor is open otherwise FALSE.

42.PL/SQL Tables

It is an object type table and is used to hold the data at runtime and the size of the PL/TABLE is dynamic.

43.VARRAYS and PL/SQL Table Differences?

VARRAYS size is fixed and PL/SQL table size is dynamic.

44.Difference between PL/SQL table and Cursor?

Cursor will not use index to fetch the fifth row it has to fetch all the five rows to give the fifth row. Cursor will not work on multiple tables.PL/SQL table will use the index. By using the index we can directly fetch whatever row we want in the table PL/SQL table can work on multiple tables.

45.What is Pragma?

Pragma is a precompiler directive, which directs the compiler before compilation of the program.

46.Pragma Autonomous Transaction

Used to split the whole transaction into two parts parent and child, which run parallely and both have the relation ship

Ex: ITEM ATTCHMENTS CONVERSION

47.Pragma Exception_Init?

Used to associate a user-defined exception with oracle-defined error.

Ex: Bank Account Min Balance

48.Raise_Application_Error?

It is used to create our own error messages, which can be more descriptive than named exceptions.

Syn: RAISE_APPLICATION_ERROR (error_number, error_message,

[Keep_errors]);

Where error_number is between –20,000 and –20,999, error_message is the text associated with this error, and keep_errors is a Boolean value.

49.Mutating Error, Mutating table?

It will occur whenever we try to do DML operations on a table, which is effected by a trigger. The table, which is affected by trigger, is known as Mutating Error.

50.Difference between Package Procedure and Procedure?

Whenever we create a procedure in the package it will compile at that time. When we call it will execute directly. Where in the ordinary procedure each and every time it compiles and execute. The main difference is package procedure better in performance.

I. The following query retrieves "2" highest paid employees FROM each Department:

SELECT deptno, empno, sal

FROM emp e WHERE 2 > ( SELECT COUNT(e1.sal) FROM emp e1

WHERE e.deptno = e1.deptno AND e.sal < e1.sal ) ORDER BY 1,3 DESC;

II. Query that will display the total no. Of employees, and of that total the number who were hired in 1980, 1981, 1982, and 1983. Give appropriate column headings.

I am looking at the following output. We need to stick to this format.

Total             1980               1981              1982                    1983

-----------    ------------ ------------      -------------         ----------

14                        1              10                            2                           1

SELECT COUNT (*), COUNT(DECODE(TO_CHAR (hiredate, 'YYYY'),'1980', empno))

"1980", COUNT (DECODE (TO_CHAR (hiredate, 'YYYY'), '1981', empno)) "1981",

COUNT (DECODE (TO_CHAR (hiredate, 'YYYY'), '1982', empno)) "1982",

COUNT (DECODE (TO_CHAR (hiredate, 'YYYY'), '1983', empno)) "1983"  FROM emp;

III. Query for listing Deptno, ename, sal, SUM(sal in that dept) :

SELECT adaptor, ename, sal, (SELECT SUM(sal) FROM emp b WHERE a.deptno =

b.deptno)

FROM emp a

ORDER BY a.deptno;

OUTPUT:

=======

DEPTNO                            ENAME              SAL                            SUM (SAL)

=========                          =======            ====                     =========

10                                         KING                  5000                            11725

30                                        BLAKE               2850                        10900

10                                        CLARK               2450                         11725

10                                        JONES               2975                          11725

30                                       MARTIN            1250                          10900

30                                      ALLEN                  1600                        10900

30                                      TURNER              1500                       10900

30                                      JAMES                  950                        10900

30                                      WARD                   2750                        10900

20                                     SMITH                   8000                        33000

20                                     SCOTT                   3000                         33000

20                                     MILLER                20000                      33000

IV. Create a matrix query to display the job, the salary for that job based on department number, and the total salary for that job for all departments, giving each column an appropriate heading.

The output is as follows - we need to stick to this format:

Job                    Dept 10                  Dept 20                    Dept 30                Total

----------           - --------------         -------------                 -------------          ---------

ANALYST                                         6000                                                             6000

CLERK               1300                       1900                            950                         4150

MANAGER      2450                        2975                            2850                      8275

PRESIDENT     5000                                                                                               5000

SALESMAN                                                                           5600                      5600

SELECT job "Job", SUM (DECODE (deptno, 10, sal)) "Dept 10", SUM (DECODE (deptno, 20, sal)) "Dept 20", SUM (DECODE (deptno, 30, sal)) "Dept 30", SUM (sal) "Total" FROM emp GROUP BY job ;

V. 4th Top Salary of all the employees:

SELECT DEPTNO, ENAME, SAL FROM EMP AWHERE 3 = (SELECT COUNT(B.SAL) FROM EMP B WHERE A.SAL < B.SAL) ORDER BY SAL DESC;

VI. Retrieving the 5th row FROM a table :

1. SELECT DEPTNO, ENAME, SAL FROM EMP WHERE ROWID = (SELECT ROWID FROM EMP WHERE ROWNUM <= 5

MINUS

SELECT ROWID FROM EMP WHERE ROWNUM < 5)

2. SELECT * FROM EMP A WHERE &N = (SELECT COUNT(ROWID)

FROM EMP B WHERE A.ROWID >= B.ROWID);

VII. Tree Query :

Name                                     Null?                                        Type

----------------             -------------------                   --------------------

SUB                                       NOT NULL                     VARCHAR2(4)

SUPER                                                                            VARCHAR2(4)

PRICE                                                                             NUMBER(6,2)

SELECT sub, super FROM parts CONNECT BY PRIOR sub = super START WITH sub = 'p1';

VIII. Eliminate duplicates rows in a table :

DELETE FROM table_name A

WHERE ROWID > ( SELECT min(ROWID) FROM table_name B WHERE A.col = B.col);

IX. Displaying EVERY 4th row in a table : (If a table has 14 rows, 4,8,12 rowswill be selected)

SELECT * FROM emp WHERE (ROWID,0) IN (SELECT ROWID, MOD(ROWNUM,4) FROM emp);

X. Top N rows FROM a table : (Displays top 9 salaried people)

SELECT ename, deptno, sal FROM (SELECT * FROM emp ORDER BY sal DESC) WHERE ROWNUM < 10;

XI. How does one count/sum RANGES of data values in a column? A value x will be between values y and z if GREATEST(x, y) = LEAST(x, z).

SELECT f2,

COUNT(DECODE(greatest(f1,59), least(f1,100), 1, 0)) "Range 60-100",

COUNT(DECODE(greatest(f1,30), least(f1, 59), 1, 0)) "Range 30-59",

COUNT(DECODE(greatest(f1,29), least(f1, 0), 1, 0)) "Range 00-29"

FROM my_table

GROUP BY f2;

XII. For equal size ranges it migth be easier to calculate it with DECODE(TRUNC(value/range), 0, rate_0, 1, rate_1, ...).

SELECT ename "Name", sal "Salary", DECODE( TRUNC(sal/1000, 0), 0, 0.0, 1, 0.1, 2, 0.2, 3, 0.3) "Tax rate" FROM emp;

XIII. How does one count different data values in a column?

COL NAME                         DATATYPE

----------------                  ------------------------

DNO                                        NUMBER

SEX                                             CHAR

SELECT dno, SUM(DECODE(sex,'M',1,0)) MALE, SUM(DECODE(sex,'F',1,0)) FEMALE, COUNT(DECODE(sex,'M',1,'F',1)) TOTAL

FROM t1 GROUP BY dno;

XIV. Query to get the product of all the values of a column :

SELECT EXP(SUM(LN(col1))) FROM bias_table;

XV. Query to display only the duplicate records in a table:

SELECT num FROM satyam GROUP BY num HAVING COUNT(*) > 1;

XVI. Query for getting the following output as many number of rows in the

table :

*

**

***

****

*****

SELECT RPAD(DECODE(temp,temp,'*'),ROWNUM,'*') FROM bias_table1;

XVII. Function for getting the Balance Value :

FUNCTION F_BALANCE_VALUE (p_business_group_id number, p_payroll_action_id number,

p_balance_name varchar2, p_dimension_name varchar2) RETURN NUMBER IS

l_bal number; l_defined_bal_id number; l_assignment_action_id number;

BEGIN SELECT assignment_action_id INTO l_assignment_action_id FROM pay_assignment_actions

WHERE

assignment_id = :p_assignment_id

AND payroll_action_id = p_payroll_action_id;

SELECT

defined_balance_id

INTO l_defined_bal_id

FROM

pay_balance_types pbt, pay_defined_balances pdb, pay_balance_dimensions pbd

WHERE

pbt.business_group_id = p_business_group_id

AND UPPER(pbt.balance_name) = UPPER(p_balance_name)

AND pbt.business_group_id = pdb.business_group_id

AND pbt.balance_type_id = pdb.balance_type_id

AND UPPER(pbd.dimension_name) = UPPER(p_dimension_name)

AND pdb.balance_dimension_id = pbd.balance_dimension_id;

l_bal := pay_balance_pkg.get_value(l_defined_bal_id,l_assignment_action_id);

RETURN (l_bal);

exception

WHEN no_data_found THEN RETURN 0; END;

XVIII. Function for getting the Element Value :

FUNCTION f_element_value(

p_classification_name in varchar2, p_element_name in varchar2, p_business_group_id in number, p_input_value_name in varchar2, p_payroll_action_id in number, p_assignment_id in number )

RETURN number

IS

l_element_value number(14,2) default 0; l_input_value_id pay_input_values_f.input_value_id%type; l_element_type_id pay_element_types_f.element_type_id%type;

BEGIN

SELECT DISTINCT element_type_id

INTO l_element_type_id

FROM pay_element_types_f pet, pay_element_classifications pec

WHERE pet.classification_id = pec.classification_id

AND upper(classification_name) = upper(p_classification_name)

AND upper(element_name) = upper(p_element_name)

AND pet.business_group_id = p_business_group_id;

SELECT input_value_id

INTO l_input_value_id

FROM pay_input_values_f

WHERE upper(name) = upper(p_input_value_name)

AND element_type_id = l_element_type_id;

SELECT NVL(prrv.result_value,0)

INTO l_element_value

FROM pay_run_result_values prrv,

pay_run_results prr,

pay_assignment_actions paa

WHERE prrv.run_result_id = prr.run_result_id

AND prr.assignment_ACTION_ID = paa.assignment_action_id

AND paa.assignment_id = p_assignment_id

AND input_value_id = l_input_value_id

AND paa.payroll_action_id = p_payroll_action_id;

RETURN (l_element_value);

exception

WHEN no_data_found THEN RETURN 0; END;

XIX. SELECT Query for counting No of words :

SELECT ename, NVL(LENGTH(REPLACE(TRANSLATE(UPPER(RTRIM(ename)),'ABCDEFGHIJKLMNOPQRSTU

VWXYZ'' ',' @'),' ',''))+1,1) word_length

FROM emp;

  Explanation :

TRANSLATE(UPPER(RTRIM(ename)),'ABCDEFGHIJKLMNOPQRSTUVWXYZ'' ',' @')      -- This will translate all the characters FROM A-Z including a single quote to a  space. It will also translate a space to a @.

REPLACE(TRANSLATE(UPPER(RTRIM(ename)),'ABCDEFGHIJKLMNOPQRSTUVWXYZ'' ','@'),' ','')        -- This will replace every space with nothing in the above result.

LENGTH(REPLACE(TRANSLATE(UPPER(RTRIM(ename)),'ABCDEFGHIJKLMNOPQRSTUVWX YZ'' ',' @'),' ',''))+1                    -- This will give u the count of @ characters in the  above result.

XX. Function to check for a leap year :

CREATE OR REPLACE FUNCTION is_leap_year (p_date IN DATE) RETURN VARCHAR2 AS v_test DATE;

BEGIN

v_test := TO_DATE ('29-Feb-' || TO_CHAR (p_date,'YYYY'),'DD-Mon-YYYY');

RETURN 'Y';

EXCEPTION

WHEN OTHERS THEN

RETURN 'N';

END is_leap_year;

SQL> SELECT hiredate, TO_CHAR (hiredate, 'Day') weekday FROM emp

WHERE is_leap_year (hiredate) = 'Y';

XXI. Query for removing all non-numeric :

SELECT TRANSLATE(LOWER(ssn),'abcdefghijklmnopqrstuvwxyz- ','') FROM DUAL;

XXII. Query for translating a column values to INITCAP:

SELECT TRANSLATE(INITCAP(temp), SUBSTR(temp, INSTR(temp,'''')+1,1), LOWER(SUBSTR(temp, INSTR(temp,'''')+1))) FROM bias_table1;

XXIII. Function for displaying Rupees in Words :

CREATE OR REPLACE FUNCTION to_word_i (amount IN NUMBER) RETURN VARCHAR2 AS

v_length INTEGER := 0;

v_num2 VARCHAR2 (50) := NULL;

v_amount VARCHAR2 (50) := TO_CHAR (TRUNC (amount));

v_word VARCHAR2 (4000) := NULL;

v_word1 VARCHAR2 (4000) := NULL;

TYPE myarray IS TABLE OF VARCHAR2 (255);

v_str myarray := myarray (' Thousand ', ' Lakh ', ' Crore ');

BEGIN

IF ((amount = 0) OR (amount IS NULL)) THEN v_word := 'zero';

ELSIF (TO_CHAR (amount) LIKE '%.%') THEN IF (SUBSTR (amount, INSTR (amount, '.') + 1) > 0) THEN

v_num2 := SUBSTR (amount, INSTR (amount, '.') + 1);

IF (LENGTH (v_num2) < 2) THEN v_num2 := v_num2 * 10;

END IF;

v_word1 := ' AND ' || (TO_CHAR (TO_DATE (SUBSTR (v_num2, LENGTH (v_num2) - 1,2), 'J'),'JSP' ))|| ' paise ';

v_amount := SUBSTR(amount,1,INSTR (amount, '.')-1);

v_word := TO_CHAR (TO_DATE (SUBSTR (v_amount, LENGTH (v_amount) - 2,3), 'J'), 'Jsp' ) || v_word;

v_amount := SUBSTR (v_amount, 1, LENGTH (v_amount) - 3);

FOR i in 1 .. v_str.COUNT LOOP

EXIT WHEN (v_amount IS NULL);

v_word := TO_CHAR (TO_DATE (SUBSTR (v_amount, LENGTH (v_amount) -

1,2), 'J'), 'Jsp' ) || v_str (i) || v_word;

v_amount := SUBSTR (v_amount, 1, LENGTH (v_amount) - 2);

END LOOP;

END IF;

ELSE

v_word := TO_CHAR ( TO_DATE ( TO_CHAR ( amount, '999999999') , 'J'), 'JSP');

END IF;

v_word := v_word || ' ' || v_word1 || ' only '; v_word := REPLACE (RTRIM (v_word), ' ', ' ');

v_word := REPLACE (RTRIM (v_word), '-', ' ');

RETURN INITCAP (v_word);

END to_word_i;

XXIV. Query for deleting alternate even rows FROM a table :

DELETE FROM bias_table WHERE (ROWID,0) IN (SELECT ROWID, MOD(ROWNUM,2) FROM bias_table);

XXV. Query for deleting alternate odd rows FROM a table :

DELETE FROM bias_table WHERE (ROWID,1) IN (SELECT ROWID, MOD(ROWNUM,2) FROM bias_table);

XXVI. Procedure for sending Email :

CREATE OR REPLACE PROCEDURE Send_Mail

IS

sender VARCHAR2(50) := 'sender@something.com';

recipient VARCHAR2(50) := 'recipient@something.com';

subject VARCHAR2(100) := 'Test Message';

message VARCHAR2(1000) := 'This is a sample mail ....';

lv_mailhost VARCHAR2(30) := 'HOTNT002';

l_mail_conn utl_smtp.connection;

lv_crlf VARCHAR2(2):= CHR( 13 ) || CHR( 10 );

BEGIN

l_mail_conn := utl_smtp.open_connection (lv_mailhost, 80);

utl_smtp.helo ( l_mail_conn, lv_mailhost);

utl_smtp.mail ( l_mail_conn, sender);

utl_smtp.rcpt ( l_mail_conn, recipient);

utl_smtp.open_data (l_mail_conn);

utl_smtp.write_data ( l_mail_conn, 'FROM: ' || sender || lv_crlf);

utl_smtp.write_data ( l_mail_conn, 'To: ' || recipient || lv_crlf);

utl_smtp.write_data ( l_mail_conn, 'Subject:' || subject || lv_crlf);

utl_smtp.write_data ( l_mail_conn, lv_crlf || message);

utl_smtp.close_data(l_mail_conn);

utl_smtp.quit(l_mail_conn);

EXCEPTION

WHEN OTHERS THEN

DBMS_OUTPUT.PUT_LINE('Error');

END;

XXVII. Alternate Query for DECODE function :

SELECT case

WHEN sex = 'm' THEN 'male'

WHEN sex = 'f' THEN 'female'

ELSE 'unknown'

END

FROM mytable;

XXVIII. Create table adding Constraint to a date field to SYSDATE or 3 months later:

CREATE TABLE bias_table(dt1 date DEFAULT SYSDATE, dt2 date,

CONSTRAINT check_dt2 CHECK ((dt2 >= dt1) AND (dt2 <=

ADD_MONTHS(SYSDATE,3)));

XXIX. Query to list all the suppliers who supply all the parts supplied by supplier 'S2' :

SELECT DISTINCT a.SUPP FROM ORDERS a WHERE a.supp != 'S2' AND a.parts IN (SELECT DISTINCT PARTS FROM ORDERS WHERE supp = 'S2') GROUP BY a.SUPP HAVING COUNT(DISTINCT a.PARTS) >=

(SELECT COUNT(DISTINCT PARTS) FROM ORDERS WHERE supp = 'S2');

Table : orders

SUPP                                      PARTS

--------------------                    -------

S1                                              P1

S1                                                P2

S1                                                   P3

S1                                                P4

S1                                                P5

S1                                                P6

S2                                               P1

S2                                               P2

S3                                               P2

S4                                               P2

S4                                                P4

S4                                                 P5

XXX. Query to get the last Sunday of any month :

SELECT NEXT_DAY(LAST_DAY(TO_DATE('26-10-2001','DD-MM-YYYY')) - 7,'sunday') FROM DUAL;

XXXI. Query to get all those who have no children themselves :

table data :

id                name                  parent_id

-------------------                  ------------

1                    a                        NULL - the top level entry

2                    b                       1 - a child of 1

3                   c                         1

4                    d                        2 - a child of 2

5                    e                        2

6                    f                          3

7                    g                        3

8                     h                        4

9                     i                         8

10                  j                         9

SELECT   ID FROM MY_TABlE WHERE PARENT_ID IS NOT NULL MINUS

SELECT PARENT_ID FROM MY_TABlE;

XXXII. Query to SELECT last N rows FROM a table :

SELECT empno FROM emp WHERE ROWID in (SELECT ROWID FROM emp

MINUS SELECT ROWID FROM emp WHERE ROWNUM <= (SELECT COUNT(*)-5 FROM emp));

XXXIII. SELECT with variables:

CREATE OR REPLACE PROCEDURE disp AS xTableName varchar2(25):='emp'; xFieldName varchar2(25):='ename';

xValue NUMBER; xQuery varchar2(100);

name varchar2(10) := 'CLARK';

BEGIN

xQuery := 'SELECT SAL FROM ' || xTableName || ' WHERE ' || xFieldName || ' = ''' || name || '''';

DBMS_OUTPUT.PUT_LINE(xQuery);

EXECUTE IMMEDIATE xQuery INTO xValue; DBMS_OUTPUT.PUT_LINE(xValue);

END;

XXXIV. Query to get the DB Name:

SELECT name FROM v$database;

XXXV. Getting the current default schema :

SELECT SYS_CONTEXT('USERENV','CURRENT_SCHEMA') FROM DUAL;

XXXVI. Query to get all the column names of a particular table :

SELECT column_name FROM all_tab_columns WHERE TABLE_NAME = 'ORDERS';

XXXVII. How do I spool only the query result to a file in SQLPLUS :

Place the following lines of code in a file and execute the file in SQLPLUS :

set heading off

set feedback off

set colsep ' '

set termout off

set verify off

spool c:\chaitu.txt

SELECT empno,ename FROM emp; /* Write your Query here */

spool off

/

XXXVIII. Query for getting the current SessionID :

SELECT SYS_CONTEXT('USERENV','SESSIONID') Session_ID FROM DUAL;

XXXIX. Query to display rows FROM m to n :

To display rows 5 to 7 :

SELECT DEPTNO, ENAME, SAL

FROM EMP

WHERE ROWID IN

(SELECT ROWID FROM EMP

WHERE ROWNUM <= 7

MINUS

SELECT ROWID FROM EMP

WHERE ROWNUM < 5);

OR

SELECT ename FROM emp

GROUP BY ROWNUM, ename

HAVING ROWNUM > 1 and ROWNUM < 3;

XXXX. Query to count no. Of columns in a table:

SELECT COUNT(column_name) FROM user_tab_columns WHERE table_name = 'MYTABLE';

XXXXI. Procedure to increase the buffer length :

dbms_output.enable(4000); /*allows the output buffer to be increased to the

specified number of bytes */

DECLARE

BEGIN

dbms_output.enable(4000);

FOR i IN 1..400

LOOP

DBMS_OUTPUT.PUT_LINE(i);

END LOOP;

END;

/

XXXXII. Inserting an & symbol in a Varchar2 column :

Set the following to some other character. By default it is &. set define '~'

XXXXIII. Create Query to restrict the user to a single row :

CREATE OR REPLACE TRIGGER TRIG_N

BEFORE UPDATE OR DELETE ON EMP

FOR EACH ROW

WHEN(OLD.EMPNO=7788)

BEGIN

RAISE_APPLICATION_ERROR('-20001' ,'CANT DO ANY OPERATION ON THIS ROW');

END;

SQL> UPDATE EMP SET SAL=SAL+1 WHERE EMPNO=7788;

XXXXIV. Query to get the first inserted record FROM a table :

SELECT * FROM T_N WHERE ROWNUM=1;

XXXXV. How to concatenate a column value with multiple rows :

XXXXVI. Query to delete all the tables at once :

XXXXVII. SQL Query for getting Orphan Records :

XXXXVIII. How do you remove Trailing blanks in a spooled file :

Change the Environment Options Like this :

set trimspool on

set trimout on

XXXXIX. Samples for executing Dynamic SQL Statements :

Sample :1

CREATE OR REPLACE PROCEDURE CNT(P_TABLE_NAME IN VARCHAR2)

AS

SqlString VARCHAR2(200);

tot number;

BEGIN

SqlString:='SELECT COUNT(*) FROM '|| P_TABLE_NAME;

EXECUTE IMMEDIATE SqlString INTO tot;

DBMS_OUTPUT.PUT_LINE('Total No.Of Records In ' || P_TABLE_NAME || ' ARE=' || tot);

END;

Sample :2

DECLARE

sql_stmt VARCHAR2(200);

plsql_block VARCHAR2(500);

emp_id NUMBER(4) := 7566;

salary NUMBER(7,2);

dept_id NUMBER(2) := 50;

dept_name VARCHAR2(14) := ’PERSONNEL’;

location VARCHAR2(13) := ’DALLAS’;

emp_rec emp%ROWTYPE;

BEGIN

EXECUTE IMMEDIATE 'CREATE TABLE bonus (id NUMBER, amt NUMBER)';

sql_stmt := 'INSERT INTO dept VALUES (:1, :2, :3)';

EXECUTE IMMEDIATE sql_stmt USING dept_id, dept_name, location;

sql_stmt := 'SELECT * FROM emp WHERE empno = :id';

EXECUTE IMMEDIATE sql_stmt INTO emp_rec USING emp_id;

plsql_block := 'BEGIN emp_pkg.raise_salary(:id, :amt); END;';

EXECUTE IMMEDIATE plsql_block USING 7788, 500;

sql_stmt := 'UPDATE emp SET sal = 2000 WHERE empno = :1

RETURNING sal INTO :2';

EXECUTE IMMEDIATE sql_stmt USING emp_id RETURNING INTO salary;

EXECUTE IMMEDIATE 'DELETE FROM dept WHERE deptno = :num'

USING dept_id;

EXECUTE IMMEDIATE ’ALTER SESSION SET SQL_TRACE TRUE’;

END;

Sample 3

CREATE OR REPLACE PROCEDURE DEPARTMENTS(NO IN DEPT.DEPTNO%TYPE) AS

v_cursor integer;

v_dname char(20);

v_rows integer;

BEGIN

v_cursor := DBMS_SQL.OPEN_CURSOR;

DBMS_SQL.PARSE(v_cursor, 'select dname from dept where deptno > :x',

DBMS_SQL.V7);

DBMS_SQL.BIND_VARIABLE(v_cursor, ':x', no);

DBMS_SQL.DEFINE_COLUMN_CHAR(v_cursor, 1, v_dname, 20);

v_rows := DBMS_SQL.EXECUTE(v_cursor);

LOOP

IF DBMS_SQL.FETCH_ROWS(v_cursor) = 0 THEN

EXIT;

END IF;

DBMS_SQL.COLUMN_VALUE_CHAR(v_cursor, 1, v_dname);

DBMS_OUTPUT.PUT_LINE('Deptartment name: '||v_dname);

END LOOP;

DBMS_SQL.CLOSE_CURSOR(v_cursor);

EXCEPTION

WHEN OTHERS THEN

DBMS_SQL.CLOSE_CURSOR(v_cursor);

raise_application_error(-20000, 'Unknown Exception Raised: '||sqlcode||' '||sqlerrm);

END;

XXXXX. Differences between SQL and MS-Access :

Difference 1:

Oracle : select name from table1 where name like 'k%';

Access: select name from table1 where name like 'k*';

Difference 2:

Access: SELECT TOP 2 name FROM Table1;

Oracle : will not work there is no such TOP key word.

XXXXXI. Query to display all the children, sub children of a parent :

SELECT organization_id,name

FROM hr_all_organization_units

WHERE organization_id in(

SELECT ORGANIZATION_ID_CHILD FROM PER_ORG_STRUCTURE_ELEMENTS

CONNECT BY PRIOR

ORGANIZATION_ID_CHILD = ORGANIZATION_ID_PARENT

START WITH

ORGANIZATION_ID_CHILD = (SELECT organization_id

FROM hr_all_organization_units

WHERE name = 'EBG Corporate Group'));

XXXXXII. Procedure to read/write data from a text file :

CREATE OR REPLACE PROCEDURE read_data

AS

c_path varchar2(100) := '/usr/tmp';

c_file_name varchar2(20) := 'EKGSEP01.CSV';

v_file_id utl_file.file_type;

v_buffer varchar2(1022) := This is a sample text’;

BEGIN

v_file_id := UTL_FILE.FOPEN(c_path,c_file_name,'w');

UTL_FILE.PUT_LINE(v_file_id, v_buffer);

UTL_FILE.FCLOSE(v_file_id);

v_file_id := UTL_FILE.FOPEN(c_path,c_file_name,'r');

UTL_FILE.GET_LINE(v_file_id, v_buffer);

DBMS_OUTPUT.PUT_LINE(v_buffer);

UTL_FILE.FCLOSE(v_file_id);

END;

XXXXXIII. Query to display random number between any two given numbers :

SELECT DBMS_RANDOM.VALUE (1,2) FROM DUAL;

XXXXXIV. How can I get the time difference between two date columns :

SELECT

FLOOR((date1-date2)*24*60*60)/3600) || ' HOURS ' || FLOOR((((date1-date2)*24*60*60) -

FLOOR(((date1-date2)*24*60*60)/3600)*3600)/60) || ' MINUTES ' ||

ROUND((((date1-date2)*24*60*60) -

FLOOR(((date1-date2)*24*60*60)/3600)*3600 -

(FLOOR((((date1-date2)*24*60*60) -

FLOOR(((date1-date2)*24*60*60)/3600)*3600)/60)*60))) || ' SECS ' time_difference FROM my_table;

XXXXXV. Display Nth MAX Sal of Employee where Salary must be Distinct:

SELECT * FROM EMP WHERE SAL=(SELECT SAL FROM

(SELECT DISTINCT(SAL) FROM

EMP ORDER BY SAL DESC) HAVING ROWNUM=4

GROUP BY ROWNUM, SAL)

XXXXXVI. Display Current Username which you have logged in:

1. SELECT USER FROM DUAL;

2. SELECT S.USERNAME

FROM V$PROCESS P,

V$SESSION S

WHERE P.ADDR = S.PADDR AND

S.AUDSID = USERENV('SESSIONID')

XXXXXVII. Will This Query Works and What will be the output:

1. SELECT 'A ''WRONG'' word.' FROM DUAL;

2. SELECT DISTINCT * FROM EMP;

3. SELECT ROWID ROWNUM, ENAME, SAL FROM EMP;

XXXXXVIII. Count the Columns in the table name:

SELECT COUNT(*) FROM USER_TAB_COLUMNS WHERE TABLE_NAME LIKE 'EMP'

                                                                              ERP QUERY BOOK

1. Can we give extensions in executable file name?

a) No, because it wont allow periods and spaces in execution file name.

2. How many colors are there in forms?

b) Yellow - Mandatory

White - Optional

Blue - Query Mode

Grey - Read Only

3. What is the PRIORITY field in the Concurrent Program?

a) According to user priority the concurrent program will run.

4. What are the mandatory columns in Executable?

a) Executable

Short name

Applications

Executtion Method

Execution file name

5. What is the Application in Executable?

a) It will give the location of the object.

6. What is the Range function in the concurrent program parameter window?

a) It will give low and high values.

7. What is Copy to Button in concurrent program window?

a) It is used to get the new copy of existing concurrent program with parameters and Incompatibilities.

8. What is a Session Control button in concurrent program window?

a) If we have bulk of inserts and updates when we want to rollback those we will use

It has three parametes

 Consumer group

 Rollback Segment

 Optimizer mode

9. What are the types of incompatibilities concurrent program window?

a) Two types

 Domain

 Global

10.What are the types of Output formats in concurrent program window?

a) There are 6 types of Output formats

 HTML

 PDF

 PCL

 TEXT

 XML

 POST SCRIPT

11.What are the Styles in concurrent program window?

> A4                              - 80×66

> landscape              - 132×66

> landwide               - 180×66

> Bacs                        - 2000×66

12.What is Application Top? What are the types and Purpose?

a) When we connect to the server we will find the top called application top. Its

Types.

 Product top

 Custom top

Product top is the default top built by the manufacturer and Custom top is used to select the Client for his business purposes. Customizations are done with the Custom top.

13.What is US folder in the Custom Top?

It is a language specific folder used to store the G.U.I like reports and forms.

14.what are mandatory parameters of Procedures and what the use of those?

a) Errorbuf: It is used to returns the error messeges and sent it to the log file.

b) Retcode: It is used to show the status of the Procedure with 0,1,2

0 for Completed Normal

1 for Completed Warning

2 for Completed Error

15. What is Apps Schema and Schema?

a) Schema: Schema is the location in database contains database objects like views, tables, synonyms.

Apps Schema: It is used to connect the all schemas to get the information from

The database.

16. Token

a) Use to transfer values to report builder and it is not case sensitive.

17. AOL Objects?

a) The objects which reside under the FND tables are AOL Objects.

18. Difference between FORM, Function and Menu?

a) A menu is a hierarchical arrangement of functions and menus. Each responsibility

has a menu assigned to it. A function is a part of an application that is registered

under a unique name for the purpose of assigning it to be including it from a menu.

19. Valueset Definition?

a) Valueset is nothing but a list of values with validation.

20. Naming Conventions of Valuset?

a) While defining the Valueset we have to follow some naming conventions

No Spaces it will allow, It will Allow periods, Special Characters, and it is Case sensitive.

1) What is ERP? Architecture of apps?

A packaged business software system that lets a company automate and integrate the majority of its business processes; share common data and practices across the  enterprise; [and] produce and access information in a real-time environment.

2) Tell me some thing about SQL-LOADER.

Sql * loader is a bulk loader utility used for moving data from external files into the

oracle database.

Sql * loader supports various load formats, selective loading, and multi-tables loads.

1) Conventional  --The conventional path loader essentially loads the data by using standard ‘insert’ statement.

2) Direct -- the direct path loader (direct = true) by possess of logic involved with that, and loads directly in to the oracle data files.

EX:-

My data.csv file 1001, “scott tiger”,1000,40 1002,”gvreddy”,2345,50

Load data Infile ‘c:\data\mydata.csv’

Into table emp

Fields terminated by “,” optionally enclosed by ‘”’ (empno, empname,sal,deptno)

>sqlldr scott/tiger@vis control=loader.ctl log= gvlog.log bad=gvbad.bad discard=gvdis.dsc .

3) how do u dump data from pl/sql block to flat files?

Using utl_file package, we can dump data from pl/sql block to flat file. PRE-REQUIREMENTS for UTL_FILE is specify the accessible directories for the UTL_FILE function in the initialization file (INIT.ORA) Using the UTL_FILE_DIR parameters.

Ex: UTL_FILE_DIR = <Directory name>

EX:-

--remember to update INITSID.ORA,

--utl_file_dir = ‘c:\oradata’

Declare

Fp utl_file.file_type;

Begin

Fp := utl_file.fopen(c:\oradata’,tab1.txt’,’w’);

Utl_file.putf(fp,’%s %s \n ‘text field’, 55);

file.fclose(fp); End;

4) What is SET-OF-BOOKS?

Collection of Chart of Accounts and Currency and Calendars is called SOB

5) What is the interface?

Interface Table is a table which is used as medium for transfer of data between two systems.

6) What is invoice?

Send you a request for payment

7) What is INBOUND and OUT BOUND? (Different types of interfaces) Inbound Interface:

For inbound interfaces, where these products are the destination, interface tables as well as supporting validation, processing, and maintenance programs are provided.

Outbound Interface:

For outbound interfaces, where these products are the source, database

views are provided and the destination application should provide the validation,

processing, and maintenance programs

8) Tell me what r the Base tables in the AR?

hz_parties (party_id) (store info about org, groups and people)

HZ_PARTIES stores information about parties such as organizations,

people, and groups, including the identifying address information for the party.

hz_cust_accounts (cust_account_id)

HZ_CUST_ACCOUNTS stores information about customer relationships. If a

party becomes a customer, information about the customer account is stored in this

table. You can establish multiplecustomer relationships with a single party, so each party

can have multiple customer account records in this table.

hz_cust_acct_sites_all (cust_acct_site_id)

HZ_CUST_ACCT_SITES_ALL stores information about customer sites.One

customer account can have multiple sites. The address is maintained in HZ_LOCATIONS.

hz_cust_site_uses_all (site_use_id)

HZ_CUST_SITE_USES_ALL stores information about site uses or business

purposes. A single customer site can have multiple site uses, such as bill to or ship to,

and each site use is stored as a record in this table.

hz_party_sites (party_site_id)

HZ_PARTY_SITES stores information about the relationship between Parties

and Locations. The same party can have multiple party sites.Physical addresses are

stored in HZ_LOCATIONS.

hz_locations (location_id)

HZ_LOCATIONS stores information about physical locations.

hz_Person_Profiles (person_profile_id)

HZ_PERSON_PROFILES stores detail information about people.

hz_Organization_Profiles (organization_profile_id)

HZ_ORGANIZATION_PROFILES stores credit rating, financial statistics, socioeconomic and corporate linkage information for business sites. The primary key for this table is ORGANIZATION_PROFILE_ID.

9) What r the table’s interface tables in the customer interface tables?

1) Ra_customers_interface_all

This table stores customer, address, and business purpose information. You do not have to enter values in this table if you do not want to import customers, addresses, or business purposes. ADDRESS1 through 4 Enter the address for your customer in these four columns. You can enter up to four lines of an address.

Validation:

If you enter a value in ORIG_SYSTEM_ADDRESS_REF, you must enter a value in ADDRESS1. For multiple rows with the same address reference, insert values in address

1–4.

Destination: HZ_LOCATIONS.ADDRESS1,

HZ_LOCATIONS.ADDRESS2,

HZ_LOCATIONS.ADDRESS3,

HZ_LOCATIONS.ADDRESS4

2) Ra_customer_profile_int_all

A customer level profile must exist in A_CUSTOMER_PROFILES_INTERFACE for new customers and each bill–to business purpose.

3) Ra_contact_phones_int_all

This table stores telephone numbers for customers, addresses and contacts as well as contacts for customers and addresses.

4) Ra_customer_banks_int_all

This table stores bank information for a customer or for a specific Bill–To address, youmust enter a bank account for this customer,

5) Ra_cust_paymethod_int_all

To import payment methods for customers and bill–to business purposes,

10) What r the staging tables in the customer interface?

Ra_customers_stg

Ra_customers_address_stg

Ra_customers_point_stg

Ra_customers_contact points_stg

Ra_customers_relate_stg

Ra_customer_error.

11) Tell me some mandatory columns in the customer interface tables?

a) Ra_customers_interface_all

1) Orig_system_customer_ref

2) insert_update_flag

3) customer_number

4) customer_status

5)last_updated_by

6) last_updated_date

7)created_by

8) creation_date.

b) Ra_customer_profile_int_all

1) customer_profile_class_name

c) Ra_contact_phones_int_all

1)orig_system_telephone_ref

2)telephone

3) telephone_type

d) Ra_customer_banks_int_all

1) bank_a/c_name

2)bank_a/c_no

3)bank_a/c_currency_code

e) Ra_cust_paymethod_int_all

1) payment_method_name

12) Tell me the Navigation for customer interface?

Receivables  Interface  Customers

1. What tables cannot be updated through customer interface?

No updates will be allowed to be made through customer interface for Following tables.

RA_SITE_USES_ALL

RA_CUSTOMER_RELATIONSHIPS_ALL

RA_CUST_RECEIPT_METHODS

AP_BANK_BRANCHES

AP_BANK_ACCOUNTS_ALL

AP_BANK_ACCOUNT_USES_ALL

2. How to send additional customer and address information through customer interafce?

Here is where attribute columns are used.

* Additional Customer data can be populated in

RA_CUSTOMERS_INTERFACE_ALL.customer_attribute1 to 15

This will go into RA_CUSTOMERS.attribute1 to 15

* Additional address information can be populated in

RA_CUSTOMERS_INTERFACE_ALL.address_attribute1 to 15

This will go into RA_ADDRESSES_ALL.attribute1 to 15

And so on.

5. What should be the batch size (number of customer records) general guidelines for optimal performance

About 10,000 records per bacth is ideal, it is suggested to keep the batch size small.

6. Why does customer interface error out if there is mismatch in address information?

Because the code validates against these mismatches. arplscin.sql and arplbcin.sql Itvalidates the address being inserted or updated with respect to the tax location flexfeild structure. For each row being inserted or updated in RA_CUSTOMERS_INTERFACE, and

that has not already been marked in error, the set_location_ccid function is called to return either an existing ccid for the address entered or to create a new entry in AR_LOCATION_VALUES for this new address. The RA_CUSTOMERS_INTERFACE record

is then updated with the value of the ccid returned.

7. How do you send records at customer level profile and address/site level profile?

For every customer record in RA_CUSTOMERS_INTERFACE_ALL, insert two records in table RA_CUSTOMER_PROFILES_INT_ALL. (Refer Note: 1070800.6 )

8. Does Customer Interface import salesperson data?

No, Refer Enhancement Bug: 147495

9. Customer Interface process can be used for updating the customer information How does the UPDATE work?

Current functionality of Customer Interface is to update all the data. You cannot run Customer Interface to update only changed data. (Refer Bug: 879121 for the intended functinality)

10. What are some of the important fields that Customer Interface does not load?

Not all fields in RA_CUSTOMERS are being loaded by the interface.

SIC_CODE

GSA_INDICATOR

FOB_POINT

SALES_CHANNEL_CODE

FREIGHT_TERM

WAREHOUSE_ID

PRICE LIST

SHIP_PARTIAL

PAYMENT_TERM_ID in RA_SITE_USES.PAYMENT_TERM_ID

(Refer Enhancement Request Bug: 245300)

11. New TCA/Customer Model, how to load customer as PERSON or ORGANIZATION through Customer Interface?

a) Populate ra_customers_interface_all . person_flag = 'Y'

Run Customer Interface process will load this record as PERSON

b) Populate ra_customers_interface_all . person_flag = 'N' ( or NULL )

Run Customer Interface process will load this record as ORGANIZATION

12) Tell me what is the procedure to develop an interface?

a. First we will get the Requirement document.

b. We will create control file based on that plot file.

c. Then the control files which loads the data into staging tables.

d. Through pl/sql programs we will mapping and validate the data and then dump into the interface tables.

e. Through the standard programs we will push the data from interface tables to Base tables.

13) What validations u did in the customer interface?

f. customer name : the same customer reference can’t have different customer names with in this table HZ_PARTIES.PARTY_NAME

g. customer number : must be null if your r using automatic customer numbering, must exit if you are not using automatic customer numbering. This value much be unique with in HZ_PARTIES

h. customer status : must be ‘A’ for active or ‘I’ for inactive HZ_PARTIES_STATUS

i. bank account num or bank account currency code :

if the bank a/c already exist do not enter a value

if the bank a/c does not exist you must enter a value

j. bank a/c name : it must exist in AP_BANK_ACCOUNTS or if it does not

exist values must exist for BANK_A/C_CURRENCY_CODE

BANK_A/C_NUM

BANK_NAME

BANK_BRANCH_NAME

Note : every interface table has two error msg

1) Error code.

2) Error msg.

14) How can u call a standard interface program from sql or pl/sql code?

FND_REQUEST.SUBMIT_REQUEST (‘PO’,’EXECUTABLE NAME’,,,,PARAMETERS)

15) API’s FOR CUSTOMER INTERFACE? 

HZ_CUST_A/C_VZPUB.UPDATE_CUST_A/C

HZ_CUST_A/C_VZPUB.CREATE_CUST_A/C

FND_PROFILES

FND_APPLICATIONS

FND_GLOBAL

FND-FILE

FND_CONCSUB(can submit conc program in host invironment)

16) Tell me some API?

FND_FILE.PUTLINE(FND_FILE.LOG)

FND_FILE.PUTLINE(FND_FILE.OUTPUT)

Is the Program exits, delete conc program and its executables.

IF FND_PROGRAM.PROGRAM_EXITS(‘EMP’,APPLICATION_NAME_IN) THEN

FND_PROGRAM.DELETE_PROGRAM(‘EMP’,APPLICATION_NAME_IN)

FND_PROGRAM.DELETE_EXECUTABLE(‘EMP’,APPLICATION_NAME_IN)

END;

17) What are profile options?

Is the Functional and Technical behavior of Oracle Applications Package.

EX: - I want to assign the user3 responsibility to p4 printer then

System Administrator Profile System

(FND_PROFILE_OPTIONS)

18) Oracle E-Business suite?

Oracle apps + analytical components software.

(Oracle discover)

(Oracle sales analyzer)

(Oracle financial analyzer)

(Oracle marketing analyzer)

19) What is multi org?

“Legal entity has more than one operating unit is called as multi org”

a) Business group --- Human resources information is secured by Business group

b) Legal entity. --- inter-company and fiscal/tax reporting. Security  responsibility  operating unit.

c) Operating unit --- secures AR, OE, AP, PA and PO Information.

d) Organizations --- is a specialize unit of work at particular locations

20) What are the User PARAMETERS in the Reports?

P_CONC_REQUEST_ID

P_FLEX_VALUE

21) FND USER EXITS:-

FND SRWINIT sets your profile option values, multiple organizations and allows Oracle Application Object Library user exits to detect that they have been called by an Oracle Reports program.

FND SRWEXIT ensures that all the memory allocated for AOL user exits have been freed up properly.

FND FLEXIDVAL are used to display flex field information like prompt, value etc

FND FLEXSQL these user exits allow you to use flex fields in your reports

FND FORMAT_CURRENCY is used to print currency in various formats by using formula column

22) PL/SQL stored procedure parameters? (or) what are the two parameters that are mandatory for pl/sql type concurrent program?

Procedure/function (ERRBUF OUT

RETCODE OUT

………………….)

ERRBUF :- Used to write the error message to log or request file.

RETCODE :- Populate log request file with program submission details info.

23) What is Value Set?

--The value set is a collection (or) container of values.

--When ever the value set associated with any report parameters. It provides list of values to the end user to accept one of the values as report parameter value.

-- If the list of values needed to be dynamic and ever changing and define a table based values set.

24) What r the validation types?

1) None -------- validation is minimal.

2) Independent ------input must exist on previously defined list of values

3) Dependent ------input is checked against a subset of values based on a

prior value.

3) Table ----- input is checked against values in an application table

4) Special ------values set uses a flex field itself.

5) Pair ------ two flex fields together specify a range of valid values.

6) Translatable independent ----- input must exist on previously defined list

of values; translated values can be used.

7) Translatable dependent ------- input is checked against a subset of values

based on a prior values; translated value can be used.

25) Form development process?

a) open template form

b) Save as <your form>.fmb

c) Change the form module name as form name.

d) Delete the default blocks, window, and canvas

e) Create a window.

f) Assign the window property class to window

g) Create a canvas (subclass info)

h) Assign canvas property class to the canvas

I) assign the window to the canvas and canvas to the window

j) Create a data block

k) Modify the form level properties. (sub class item  Text item)

l) Modify the app_cusom package. In the program unit.

m) Modify the pre-form trigger (form level)

n) Modify the module level properties ((console window, First navigation

p) Save and compile the form.

Place the .fmx in the server directory.

25.a) Register in the AOL

APPLICATION  FORM

APPLICATION  FUNCTION

APPLICATION  MENU

26) How does u customize the Reports?

a. Identify the Short name of the standard report in which module we have to customize

Ex: - if u wants to customize in the AR module path is

Appl top\ar\11.5.0\reports\US\ .rdf

b. Open the .rdf file in Report builder and change the name of the module.

c. Open the data module and modify the query (what is client requirements) assign the columns to the attributes.

d. Go to report wizard and select, what r the newly created columns.

e. Then Compile it. Then u will get a .rep file in the specified module. If it is not in the specified directory then we have to put in the server directory.

f. Then Register in the AOL Concurrent  Executable. Concurrent  Program.

g. Go to system administrator SecurityResponsibilityrequest.

h. Add and assign a concurrent program to a request group

27) Registering parametric report?

Any applications will have two parameters,

1) from-period 2) to-period

a) Go to object navigator and create the parameters.

User parameters ->from_no, to_no (data type char and width 30)

b) Open the report layout and write the query(we have to reg the table in AOL) Select empno,ename,from g_emp where empno between :from_no and to_no

c) Compile and put the .RDP file in the server directory.

d) Registering in AOL.

Concurrent ->executable

Concurrent ->program then go to “PARAMETERS”

e) Go to Application ->validation ->set. then go to “EDIT INTO”

After entering the VALUE SETS (1) And TOKENS (2)

f) Go to Administrations Secqurity ->responsibility ->Request

h) Add and assign a concurrent program to a request group

28) Tell me some report names and their table names in GL, AP, AR, and PO?

1) ra_customer_trx_all

customer_trx_id

trx_number (invoice no, debit memo no, credit memo no)

cust_trx_type_id

2) ra_customer_lines_all (details of invoice)

cutomer_trx_id

3) ar_payment_schdules_all

check_id

This table stores all transactions except adjustments and miscellaneous cash receipts. Oracle Receivables updates this table when activity occurs against an invoice, debit memo, chargeback, credit memo, on account credit, or receipt.

4) ra_cust_trx_types_all (invoice types)

cust_trx_type_id

5) ra_batches_all

Batch_id

This table stores information about each receipt batch that you create in Oracle Receivables. Each row includes information about a specific batch such as batch source, status, batch type, control count, and control amount

6) ra_receivable_application_all

7) ra_adjustments_all

This table stores information about your invoice adjustments. Each row includes general information about the adjustment you are making such as activity name, amount, accounting information, reason, and type of adjustment. You need one row for each adjustment you are making to an invoice.

8) ra_cash_receiots_all

Cash_receipt_id

This table stores one record for each receipt that you enter. Oracle Receivables creates records concurrently in the AR_CASH_RECEIPT_HISTORY_ALL, AR_PAYMENT_SCHEDULES_ALL, and AR_RECEIVABLE_APPLICATIONS tables for invoice–

related receipts.

1) ap_invoice_all

invoice_amount, base_amount, payment_status_flag(‘y’ –fully paid

‘n’—unpaid

‘p’ –partially

paid)

2) ap_invoice_payments_all

invoice_id,

3) ap_invoice_distibutions_All

amount, base_amount, dist_code_combination_id,

line_type_lookup_code

4) ap_payment_schdules

payment_status_flag(“ ‘’’’’”)

5) ap_payment_dustributions_all

6) ap_checks_all

check_id,

AP_CHECKS_ALL stores information about payments issued to suppliers or refunds received from suppliers. You need one row for each payment you issue to a supplier or refund received from a supplier. Your Oracle Payables application uses this information to record payments you make to suppliers or refunds you receive from suppliers.

7) ap_accounting_events_all

8) ap_bank_accounts_all

AP_BANK_ACCOUNTS_ALL contains information about your bank accounts.You need one row for each bank account you define. Each bank account must be affiliated with one bank branch. When you initiate an automatic payment batch, enter a manual check, or create a Quick payment, you can select a bank account that you define

in this table.

9) ap_bank_accounts_uses_all

AP_BANK_ACCOUNT_USES_ALL stores information for the internal and external bank accounts you define in Oracle Payables and Oracle Receivables applications.

1) po_vendors_all

2) po_vendors_sites_all

3) po_headers_all

po_header_id

4) po_lines_all

po_line_id

5) po_line_locations_All

6) po_distributions_all

po_distribution_id,

1) Gl_code_combinations

GL_CODE_COMBINATIONS

stores valid account combinations for each Accounting Flexfield structure within your Oracle General Ledger application. Associated

with each account are certain codes and flags, including whether the account is enabled,

whether detail posting or detail budgeting is allowed, and others.

2) Gl_je_batches.

GL_JE_BATCHES stores journal entry batches.

3) Gl_je_headers

GL_JE_HEADERS stores journal entries. There is a one–to–many relationship between journal entry batches and journal entries. Each row in this table includes the associated batch ID, the journal entry name and description, and other information about the journal entry. This table corresponds to the Journals window of the Enter Journals form. STATUS is ’U’ for unposted, ’P’ for posted. Other statuses indicate that an error condition was found. A complete list is below.

4) Gl_je_lines.

GL_JE_LINES stores the journal entry lines that you enter in the Enter Journals form. There is a one–to–many relationship between journal entries and journal entry lines. Each row in this table stores the associated journal entry header ID, the line number, the associated code combination ID, and the debits or credits associated with the journal line. STATUS is ’U’ for unposted or ’P’ for posted

5) Gl_set of books

GL_SETS_OF_BOOKS stores information about the sets of books you define in your Oracle General Ledger application. Each row includes the set of books name, description, functional currency, and other information. This table corresponds to the Set of Books

form.

6) Gl_periods

GL_PERIODS stores information about the accounting periods you define using the Accounting Calendar form. Each row includes the start date and end date of the period, the period type, the fiscal year, the period number, and other information. There is a one–to–many relationship between a row in the GL_PERIOD_SETS table and rows in this table.

1) OPEN-DEBIT MEMO REPORT?

This report shows all the open-debit memo transactions, based on customer number and dates.

Columns :- type, customer_no, trx_no, amt_due, remaining.

Parameter :- type, customer, from_date, to_date.

2) GENERATING POSITIVE PAY FILE FOR BANK REPORT?

Basically this report generates a flat file of all the payments in order to send in to the bank.

3) UPDATE POSITIVEPAY CHECKS REPORT?

This report which updates the data into the (AP) account payables system from the plot file, the file which is sent by bank

4) UPDATE POSITIVEPAY OUT STANDING CHECKS?

This report which shows the out standing checks

5) CUSTOMER PAYMENT DETAILS REPORT?

Which shows each customer original amount, amount pay and due amount based

on transaction type (books, pens)

Transaction types in AR

Credit memo transaction types

Invoice, debit memo, and charge back transaction types

Commitment transaction types

30) HOW DO YOU RECTIFY THE ERRORS IN INTERFACE TABLES?

Depending on the naming convention used, errors appear in either alphabetical order or

by error code number.

31) How do u identity its name of report?

System administrator  concurrent  program  define

System administrator  concurrent  program executable

32) Who information’s?

1) Created by

2) Creation date

3) Last _updated by

4) last_update_date

5) last_update_value

33) FLEX FIELDS?

Used to capture the additional business information.

Presentation1Oracle Applications KEY FLEX FIELDS

1) GL :- ACCOUNTING

2) AR :- SALES TAX LOCATION, TERRITORY,

3) AP :- BANK DETAILS, COST ALLOCATION, PEOPLE GROUP

Oracle Applications DESCRIPTIVE FLEX FIELDS (Partial)

1) GL :- daily rates

2) AR :- credit history, information

3) PA :- bank branch, payment terms, site address,

34) What are the requests groups?

a) Single request: - this allows you to submit an individual request.

b) Request set : - this allows you to submit a pre-defined set of requests.

35) Sys Admin Module?

a) Define Custom Users, b) Define Login Users, c) Register oracle DB users,

d) Define Concurrent Programs, e) Register Concurrent Executables, f) Setting Profile Option Values, g) Define Request Types.

36) AOL?

a) Registering tables. b) Registering views c) Registering db sequences d) Registering profile options e) Registering lookups and lookup codes f) Registering forms g) Registering Form and Non-Form functions i) registering Menus and sub-menus. j) Registering DFF and KFF. k) Libraries

37) What r the type Models in the system parameters of the report?

1) Bit map 2) Character mode

38) .What is SRW Package? (Sql Report Writer)

The Report builder Built in package know as SRW Package This package extends reports ,Control report execution, output message at runtime, Initialize layout fields, Perform DDL statements used to create or Drop temporary table, Call User Exist, to format width of the columns, to page break the column, to set the colors

Ex: SRW.DO_SQL, It’s like DDL command, we can create table, views, etc.

SRW.SET_FIELD_NUM

SRW. SET_FILED_CHAR

SRW. SET FILED _DATE

39) Difference between Bind and Lexical parameters? BIND VARIABLE:

-- are used to replace a single value in sql, pl/sql

-- bind variable may be used to replace expressions in select, where, group, order

by, having, connect by, start with cause of queries.

-- bind reference may not be referenced in FROM clause (or) in place of

reserved words or clauses.

LEXICAL REFERENCE:

-- You can use lexical reference to replace the clauses appearing AFTER select,

from, group by, having, connect by, start with.

-- You can’t make lexical reference in pl/sql statements.

40) Matrix Report: Simple, Group above, Nested

Simple Matrix Report: 4 groups

1. Cross Product Group

2. Row and Column Group

3. Cell Group

4. Cell column is the source of a cross product summary that becomes the cell content.

Frames: 1. Repeating frame for rows(down direction)

2. Repeating frame for columns(Across )

3. Matrix object the intersection of the two repeating frames

41) what is Flex mode and Confine mode?

Confine mode

On: child objects cannot be moved outside their enclosing parent objects.

Off: child objects can be moved outside their enclosing parent objects.

Flex mode:

On: parent borders "stretch" when child objects are moved against them.

Off: parent borders remain fixed when child objects are moved against

them.

42) What is Place holder Columns?

A placeholder is a column is an empty container at design time. The placeholder can hold a value at run time has been calculated and placed in to It by pl/sql code from anther object. You can set the value of a placeholder column is in a Before Report trigger.

Store a Temporary value for future reference. EX. Store the current max salary as records are retrieved.

43) What is Formula Column?

A formula column performs a user-defined computation on another column(s) data, including placeholder columns.

44) What is Summary columns?

A summary column performs a computation on another column's data. Using the Report Wizard or Data Wizard, you can create the following summaries: sum, average, count, minimum, maximum, % total. You can also create a summary column manually

in the Data Model view, and use the Property Palette to create the following additional summaries: first, last, standard deviation, variance.

45) What is cursor?

A Cursor is a pointer, which works on active set, I.e. which points to only one row at a time in the context area’s ACTIVE SET. A cursor is a construct of pl/sql, used to process multiple rows using a pl/sql block.

46) Types of cursors?

1) Implicit: declared for all DML and pl/sql statements. By default it selects one row only.

2) Explicit: Declared and named by the programmer. Use explicit cursor to individually process each row returned by a multiple

statements, is called ACTIVE SET. Allows the programmer to manually control explicit cursor in the Pl/sql block

a)declare: create a named sql area

b)Open: identify the active set.

c)Fetch: load the current row in to variables.

d)Close: release the active set.

CURSOR ATTRIBUTES

a) %is open: evaluates to true if the cursor is open.

b) %not found: evaluates to true if the most recent fetch does not return a row

c) %found: evaluates to true if the most recent fetch returns a row.

d) %row count: evaluates to the total number of rows returned to far.

Example for cursor:

1) Declare

Vno emp.empno%type;

Vname emp.ename %type;

Cursor emp_cursor is

Select empno,ename

From emp;

Begin

Open cursor;

For I in 1..10 loop

Fetch emp_cursor into vno,vname;

Dbms_output.putline(to_char(vno) ||’ ‘||vname);

End if;

End;

2) Begin

Open emp_cursor;

Loop

Fetch when emp_cursor % rowcount >10 or

Emp_curor % not found;

Bdms_output_put_line(to_char(vno)||’ ‘|| vname);

End loop;

Close emp_cursor;

End;

CURSOR FOR LOOP

A) cursor for loop is a short cut to process explicit cursors

B) it has higher performance

C) cursor for loop requires only the declaration of the cursor, remaining things like

opening, fetching and close are automatically take by the cursor for loop

Example:

1) Declare

Cursor emp_cursor is

Select empno,ename

From emp;

Begin

For emp_record in emp_cursor loop

Dbms_output.putline(emp_record.empno);

Dbms_output.putline(emp_record.ename)

End loop

End;

Can we create a cursor without declaring it?

Yes – by using cursor for loop using subqueries.

BEGIN

FOR emp_record IN ( SELECT empno, ename

FROM emp) LOOP

-- implicit open and implicit fetch occur

IF emp_record.empno = 7839 THEN

...

END LOOP; -- implicit close occurs

END;

a) for update clause:

1) use explicit locking to deny access for the duration of a transaction

2) lock the rows before update or delete

Ex : select ……. From…….

For update[ of column ref] [no_wait]

b) where current of clause?

1) use cursor to update or delete the current row

Where current of < column ref>

47) Attribute data types?

1) %type 2) %row type.

48) Exception Handling?

Is a mechanism provided by pl/sql to detect runtime errors and process them with

out halting the program abnormally

1) pre-defined

2) user-defined.

PRE-DEFINED:

1) cursor_already_open--------attempted to open an already open cursor.

2) Dup_val_on_index --------attempted to insert a duplicate values.

3) Invalid_cursor -------- illegal cursor operation occurred.

4) Invalid_number -------- conversion of character string to number fails.

5) Login_denied ---------loging on to oracle with an invalid user name

and password.

6) program_error -------- pl/sql has an internal problem.

7) storage_error -------- pl/sql ran out of memory or memory is

corrupted.

8) to_many_row ---------single row select returned more than one row.

9) value_error -------- arithmetic,conversion,truncation or size

constraint error occurred.

10) zero_devided -------- attempted to divided by zero.

USER-DEFINED:

Declare : name the exception

Raise : explicitly raise the exception by using the raise statements

Reference: exception handing section.

The Raise_Application_Error_Procedure:

 You can use this procedure to issue user-defined error messages from stored sub

programs.

 You can report errors to your applications and avoid returning unhandled

exceptions.

Raise_Application_Error(error_number,message[,{true/false}]

Error number  between -20000 to -20999

pragma exception_init?

It tells the compiler to associate an exception with an oracle error. To get an error message of a specific oracle error.

Ex: pragma exception_init(exception name, oracle error number)

Example for Exceptions?

1) Check the record is exist or not?

Declare

E emp% rowtype

Begin

e.empno := &empno;

select * into e from emp where empno =e.empno;

Dbms_output.putline(‘empno’ || e.empno);

Exception

When no_data_found then

Dbms_output.putline(e.empno ||’doest exist’);

End;

2) User defined exceptions?

Define p_dept_desc =’gvreddy’

Define p_dept_number =1236

Declare

E_invalid_dept exception;

Begin

Update departments

Set dept_name=’&p_dept_desc’

Where dept_id =’&p_dept_number’;

If sql% not found then

Raise e_invalid_departments;

End if;

Commit;

Exception

When e_invalid_departments then

Dbms_output.putline(‘no such dept’);

End;

49) What is REF Cursor?

To execute a multi-row query, oracle opens an unnamed work area that stores processing information, to access the information, an explicit, which names the work area or, a cursor variable, which points to the work area. where as a cursor always refers to the same query work area, a cursor variable can refer to a different work areas, cursor variable area like ‘c’ or ‘pascal’ pointers, which

hold the memory location(address) of some object instead of the object itself. So, declaring a cursor variable creates a pointers, not an object.

50) Can u define exceptions twice in same block?

No

51) Can you have two functions with the same name in a pl/sql block?

Yes

52) Can you have two stored functions with in the same name?

Yes

53) Can function be overload?

Yes

54) What is the maximum number of statements that can be specified in a trigger statement?

One.

55) Stored procedure?

Stored procedure is a sequence of statements that perform specific function.

56) What is procedure?

---- is a named pl/sql block to perform a specific task.

---- A procedure may have DML statements.

---- It may or may not return a value.

---- Procedure can return more than one value.

Example for procedure

1) To accept the year as a parameter and list emp belong to the year?

Create or replace

Procedure empy(y number) is

Cursor emp_cursor is

Select * from emp where to_char(hiredate,’yyyy’)=’y’;

Emp_record emp%rowtype;

Begin

For emp_record in emp_cursor loop

Print (emp_record.empno);

Print (emp_record.ename);

Print (emp_record.sal);

End loop;

End;

Output :

var empx number;

Begin

:empx := ‘1234’;

End;

Exec empy(:empx);

Print empy;

57) What is function?

---- is a named pl/sql block to perform a specific task, is mainly used for calculation

purpose.

---- A function is called as part of an exception.

---- Every function should return a value

Example for function

Create or replace

Function get_sal(p_id in emp.emp_no% type)

Return number

Is

v_sal emp.sal%type :=0;

Begin

Select salary into v_salary

From emp Where emp_no = p_id;

Return v_salary

End get_sal;

End;

Output :

var g_sal number;

Exec :g_sal := get_sal(99);

Print g_salary;

58) Can functions be overloaded ?

Yes.

59) Can 2 functions have same name & input parameters but differ only by return datatype

No.

60) What is the package?

---- Group logically related pl/sql types, items and subprograms.

1) package specification

2) package body

Advantages of a package:

· Modularity

· Easier Application Design

· Information Hiding

· Overloading

You cannot overload:

•Two subprograms if their formal parameters differ only in name or parameter mode.

(datatype and their total number is same).

•Two subprograms if their formal parameters differ only in datatype and the different

datatypes are in the same family (number and decimal belong to the same family)

•Two subprograms if their formal parameters differ only in subtype and the different

subtypes are based on types in the same family (VARCHAR and STRING are subtypes

of VARCHAR2)

•Two functions that differ only in return type, even if the types are in different

families.

61) What is FORWARD DECLARATION in Packages?

PL/SQL allows for a special subprogram declaration called a forward declaration. It

consists of the subprogram specification in the package body terminated by a

semicolon. You can use forward declarations to do the following:

• Define subprograms in logical or alphabetical order.

• Define mutually recursive subprograms.(both calling each other).

• Group subprograms in a package

Example of forward Declaration:

CREATE OR REPLACE PACKAGE BODY forward_pack

IS

PROCEDURE calc_rating(. . .); -- forward declaration

PROCEDURE award_bonus(. . .)

IS -- subprograms defined

BEGIN -- in alphabetical order

calc_rating(. . .);

. . .

END;

PROCEDURE calc_rating(. . .)

IS BEGIN

. . .

END;

END forward_pack;

62) What are triggers?

---- triggers are similar to procedures, in that they are the named pl/sql blocks with declarative, executable and exception-handling sections, how ever a procedure is executed explicitly from another block via a procedure call, which can also pass arguments.

---- A trigger is executed implicitly when ever a particular event task places. And is nothing but a event.

---- The triggering event is a DML (insert, update, delete) operations on a data base table

----- fires whenever a data event(such as DML) or system event(such as login or shutdown) occurs on a schema or database

Trigger timing : 1) before

2) after

3) instead of ( this is used for views)

Triggering events : 1) insert

2)update

3) delete

Trigger type : 1) statement level

3) row level.

Firing sequence of database triggers

1) before statement trigger

2) before row trigger

3) after row trigger

4) after statement trigger

Ex: - 1) Create or replace trigger secure_emp

Before

Insert on emp

Begin

If (to_char(sysdate,’dy’) in(‘sat’,’sun’)) or

To_char(sysdate,’hh24:mi’)

Not between ’08:00’ and ’18:00’)

Then raise_application_error(-20500,’u can insert in the office timings’)

End if;

End;

Ex :- 2) write a program to all transitions with name smith?

Create or replace

Trigger trigger_name

Before insert or update or delete

On emp

For each row

When (old.ename =’smith’ or

New.ename =’smith’)

Begin

Raise_application_error(-20003,’smith’);

End;

63) Difference between triggers and procedures?

Presentation1

64) LOCKS?

-- Is to reduce concurrency

1) share lock

---it allows the other users for only reading not to insert or update or delete.

2) exclusive lock

--- only one user can have the privileges of insert or update and delete of

particular object

--- others can only read.

3) update lock

----multiple user can read, update delete

Lock levels :

1) table level 2) table space 3) data base level.

65) What is template?

a) The TEMPLATE form is the required starting point for all development of new Forms.

b) The TEMPLATE form includes platform–independent attachments of several Libraries.

APPSCORE :- It contains package and procedures that are required of all forms to support the MENUS ,TOOLBARS.

APPSDAYPK :- It contains packages that control the oracle applications CALENDER FEATURES.

FNDSQF :- it contains packages and procedures for MESSAGE DICTONARY, FLEX FIELDS, PROFILES AND CONCURRENT PROCESSING.

CUSTOM :- it allows extension of oracle applications forms with out modification of oracle application code, you can use the custom library for customization such as zoom ( such as moving to another form and querying up specific records)

66) What are ad-hoc reports?

Ans.: Ad-hoc Report is made to meet one-time reporting needs. Concerned with or formed for a particular purpose. For example, ad hoc tax codes or an ad hoc database query

67) What is responsibility?

Is collection of menus, request security groups and data groups

Menus: collection of forms is nothing but menus

Request security groups: collection of programs.

Data groups: is a group of modules to be made accessible by the user through Responsibility

System admin->security->define.

Security->user->:define.

68) What are different execution methods of executables?

FlexRpt                                                        The execution file is wrnitten using the FlexReport API.

FlexSql                                                        The execution file is written using the FlexSql API.

Host                                                            The execution file is a host script.

Oracle                                                        Reports The execution file is an Oracle Reports file.

PL/SQL Stored Procedure                The execution file is a stored procedure.

SQL*Loader                                             The execution file is a SQL script.

SQL*Plus                                                  The execution file is a SQL*Plus script.

SQL*Report                                            The execution file is a SQL*Report script.

Spawned                                                   The execution file is a C or Pro*C program.

Immediate                                              The execution file is a program written to run as a subroutine of the concurrent manager. We recommend against defining new immediate concurrent programs, and suggest you use either a PL/SQL Stored Procedure or a Spawned C Program instead.

Composite Datatypes :

– PL/SQL TABLES

– PL/SQL RECORDS

- Nested TABLE

- VARRAY

69) What is the sequence of functions – group by,having,orderby in a select statements ?

Select…..

Group by…

Having…

Orderby..

Difference between User and Super User?

User : login user or front end user

Super user : it has full access of particular module.

1. Execution methods?

Ans. a. Host

b. Immediate

c. Java Stored Procedure

d. Java Concurrent Program

e. Multi Language Function

f. Oracle Reports

g. PL/SQL Stored Procedure

h. Request Set Stage Function

i. Spawned

j. SQL*Loader

k. SQL*Plus

2. What is TCA (Trading Community Architecture)?

Ans. Oracle Trading Community Architecture (TCA) is a data model that allows you to manage complex information about the parties, or customers, who belong to your commercial community, including organizations, locations, and the network of hierarchical relationships among them. This information is maintained in the TCA Registry, which is the single source of trading community information for Oracle E-Business Suite applications.

3. Difference between Application Developer and System Administrator?

Ans.

Role of Technical Consultant:

a. Designing New Forms, Programs and Reports

b. Forms and Reports customization

c. Developing Interfaces

d. Developing PL/SQL stored procedures

e. Workflow automations

Role of System Administrator:

a. Define Logon Users

b. Define New/Custom Responsibility

c. Define Data Groups

d. Define Concurrent Managers

e. Define Printers

f. Test Network Preferences

g. Define/Add new Modules

Role of an Apps DBA:

a. Installing of Application

b. Upgradation

c. Migration

d. Patches

e. Routing maintenance of QA

f. Cloning of OA

4. What are Flexfields?

Ans. A Flexfield is a customizable field that opens in a window from a regular Oracle Applications window. Defining flexfields enables you to tailor Oracle Applications to your own business needs. By using flexfields, you can:

(a) Structure certain identifiers required by oracle applications according to your own business environment.

(b) Collect and display additional information for your business as needed.

Key Flexfields: You use key flexfields to define your own structure for many of the identifiers required by Oracle Applications. Profile – ‘Flexfields:Open Key Window’(FND_ID_FLEXS)

Descriptive Flexfield: You use descriptive flexfields to gather additional information about your business entities beyong the information required by Oracle Applications. Profile –

Flexfields: Open Descr Window’ (FND_DESCRIPTIVE_FLEXS)

5. Report registration process?

Ans.

1. Create the report using the report builder.

2. Place the report definition file in the module specific reports directory.

3. Create an executable for the report definition file.

4. Create a concurrent program to that executable.

5. Associate the concurrent program to a request group.

6. User exits in Reports?

Ans.

USER EXITS are used in Oracle APPS to access user profile values and perform proper calculation.

Ex. of Other AOL User exits available in Reports are given below.

FND SRWINIT - This is a User Exit which sets your profile option values and allows Oracle AOL user exits to detect that they have been called by oracle repots. Can be used in BEFORE-REPORT Trigger.

FND_SRWEXIT - This user exit ensures that all the memory allocated for AOL user exits has been freed up properly. Can be used in AFTER- REPORT Trigger

FND FORMAT_CURRENCY - To format the currency amount dynamically depending upon the precision of the actual currency value, standard precision, users profile values and location (country) of the site.

FND FLEXSQL - This user exits allows you to use Flex fields in Reports

FND FLEXIDVAL - This user exits allows you to use Flex fields in Reports

7. Request Set and Where do you define it ?

Ans. Request sets allow you to submit multiple requests together using multiple execution path. A request set is a collection of reports and /or programs that are grouped together. A stage is a component of a request set used to group requests within the set. All of the requests in a given stage are executed in parallel. Advantages of stages are the ability to execute several requests in parallel and then move sequentially to the next stage. Responsibility: System Administrator

Nav: Concurrent -> Set

7(A). Define Request Group?

Ans. A request security group is the collection of requests, request sets, and concurrent programs that a user, operating under a given responsibility, can select from the Submit Requests window.

8. Registration of PL/SQL with parameters?

Ans.

1. Create the procedure in the module specific schema.

2. Create a public synonym for that procedure in the Apps schema.

3. Create the executable for that procedure.

4. Create a concurrent program.

5. Attach the concurrent program to that procedure.

Note: There are two mandatory parameters 1. Errbuf 2. Retcode. Any parameter which are to be passed should be succeeded with these two parameters and have to be registered. When calling the procedure, these two parameters are not mentioned.

9. How many groups in Matrix Report?

Ans. The minimum of groups required for a matrix report are 4.

10. Lexical Parameters and Bind Parameters?

Ans. Lexical references are placeholders for text that you embed in a SELECT statement. You can use lexical references to replace the clauses appearing after SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, CONNECT BY, and START WITH. You create a lexical reference by entering an ampersand (&) followed immediately by the column or parameter name. Bind references (or bind variables) are used to replace a single value in SQL or PL/SQL, such as a character string, number, or date. Specifically, bind references may be used to replace expressions in SELECT, WHERE, GROUP BY, ORDER BY, HAVING, CONNECT BY, and START WITH clauses of queries. Bind references may not be referenced in FROM clauses or in place of reserved words or clauses. You create a bind reference by entering a colon (:) followed immediately by the column or parameter name.

11. Value Sets?

Ans. Oracle Application Object Library uses values, value sets and validation tables as important components of key flexfields, descriptive flexfields, FlexBuilder, and Standard Request Submission. When you first define your flexfields, you choose how many segments you want to use and what order you want them to appear. You also choose how you want to validate each of your segments The decisions you make affect how you define your value sets and your values. You define your value sets first, either before or while you define your flexfield segment structures. You typically define your individual values only after your flexfield has been completely defined (and frozen and compiled). Depending on what type of value set you use, you may not need to predefine individual values at all before you can use your flexfield. You can share value sets among segments in different flexfields, segments in

different structures of the same flexfield, and even segments within the same flexfield structure. You can share value sets across key and descriptive flexfields. You can also use value sets for report parameters for your reports that use the Standard Report

Submission feature.

Navigation Path:

Login – Application Developer -> Application -> Validation -> Set

11(A). Value Validation Types?

Ans.

1. Dependant

2. Independent

3. None

4. Pair

5. Special

6. Table

7. Translate Independent

8. Translate Dependent

11(B). How to define a value set depending on other value set?

Ans. Navigation Path: Login -> AOL -> Application -> Validation -> Set Select the validation type as “Dependant” and click on ‘Edit Information’ button. In Dependant value set information screen mention the Independent value set name.

12. Incompatibility in report registration and Run Alone?

Ans. Identify programs that should not run simultaneously with your concurrent program because they might interfere with its execution. You can specify your program as being incompatible with itself.

Application: Although the default for this field is the application of your concurrent program, you can enter any valid application name.

Name: The program name and application you specify must uniquely identify a concurrent program. Your list displays the user-friendly name of the program, the short name, and the description of the program.

Scope: Enter Set or Program Only to specify whether your concurrent program is incompatible with this program and all its child requests (Set) or only with this program (Program Only).

Run Alone: Indicate whether your program should run alone relative to all other programs in the same logical database. If the execution of your program interferes with the execution of all other programs in the same logical database (in other words, if your

program is incompatible with all programs in its logical database, including itself), it should run alone.

13. AR-Invoices (Class)?

Ans.

1. Chargeback

2. Credit Memo

3. Debit Memo

4. Deposit

5. Guarantee

14. AP-Invoice types?

Ans.

1. Standard

2. Credit Memo

3. Debit Memo

4. Expense Report

5. PO Default

6. Prepayment

7. Quick match

8. Withholding Tax

9. Mixed

15. Customer Interface?

Ans. Use Customer Interface to import and validate current or historical customer information from other systems into Receivables. Once customer information is imported into Oracle Receivables, you can use Customer Interface to import additional data for

that customer (such as additional contacts or addresses) and to update existing information. You can also manually update and enter new information using theCustomer windows.

The following diagram shows how customer information is imported into the Oracle

Receivables tables.

             Error! Unknown switch argument.

16. Multi Org?

Ans.

Business Group each one own Set of Books)

Legal Entity (Post to a Set of Books)

Operating Units

Inventory Organizations

Manufacturing Modules (Order Entry, Purchasing, MRP etc.)

Financial Modules

17. What are Profiles?

Ans. A user profile is a set of changeable options that affect the way your application looks and behaves. As System Administrator, you control how Oracle Applications operate by setting user profile options to the values you want. You can set user profile options at four different levels: site, application, responsibility, and user. Your settings affect users as soon as they sign on or change responsibility.

Navigation Path:

 Login – System Administrator -> Profile -> System

Examples:

Signon Password Hard to Guess

Signon Password Length

Set of Books Name

Flexfields: Autoskip

18. Employee Details?

Ans. Enter employee records. Either your Human Resources department enters employee information in the People window (if HRMS is installed), or the appropriate department enters employee information in the Enter Person window. To ensure that Payables can create a supplier record during Invoice Import, the following arerequirements for each employee record:

· the employee name is unique

· reimbursement address for either Home or Office exists

· address lines 1-3 for the home address do not exceed 35 characters

· City/State/Country does not exceed 25 characters

· Zip Code for the home address does not exceed 20 characters

19. What is the Multi Org and what is it used for?

Ans. Multi Org or Multiple Organizations Architecture allows multiple operating units and their relationships to be defined within a single installation of Oracle Applications. This keeps each operating unit's transaction data separate and secure. Use the following query to determine if Muli Org is intalled: “select multi_org_flag from fnd_product_groups;”

20. AR Invoice Tables?

Ans. When you enter an invoice either through the Transaction window or through the AutoInvoice program, Receivables uses the following tables to store your invoice information:

RA_CUSTOMER_TRX

RA_CUSTOMER_TRX_LINES

RA_CUST_TRX_LINE_GL_DIST

AR_PAYMENT_SCHEDULES

21. Bitmap Report?

Ans. Bitmapped reports are output as PostScript files. The PostScript file is a set of instructions telling the printer exactly what to print and how to print it. To get a landscape report, the Post Script file must be generated as landscape. If you want a landscape bitmapped report, specify this either in the Reports Designer or in the execution options of your concurrent program. When printing bitmapped reports, a print style is still needed to determine the printer driver used. To avoid confusion, create a special print style for bitmapped reports and make that the required style for all bitmapped reports in the Define Concurrent Programs form.

22. Difference between character and bitmap report?

Ans.

Bitmap vs. Character-Mode Report Design Here is an example to help explain how Oracle Reports are designed and printed in both the bitmap and character-mode environments.

Assume you wish to print "Cc" where "C" is a different font and a larger point size than "c" and is in boldface type (where "c" is not).

In Oracle Reports Designer, bitmap mode, you can make "C" bold and in a different font and point size than "c". This is because you are generating postscript output. Postscript is a universal printer language and any postscript printer is able to interpret your

different design instructions.

In Oracle Reports Designer, character mode, the APPLICATIONS STANDARDS REQUIRE the report to be designed in ONE FONT/ ONE CHARACTER SIZE. Character mode reports generate ASCII output. In ASCII you cannot dynamically change the font and character size. The standard is in effect so a report prints as identically as possible from both conventional and postscript printers. Bitmap vs. Character-Mode Report Printing

These sequences contrast the two printing environments. In postscript, "C" can be in a different font and point size than "c". Both or either could also be bold, for example. In ASCII, "C" must be in the same font and character size as "c". Both or either could also be bold, for example.

23. What is difference between .rdf and .rep?

Ans. Report definition file <report name>.rdf

Report runfile <report name>.rep

24. Module related Flex fields?

Ans.

Key                                                                  Flexfields                Descriptive Flex fields

General Ledger -                      Accounting Flex field               Daily Rates

Assets -                                                Asset Category                              Flexfield Bonus Rates

Receivables - Sales Tax Location Credit History Information

Territory Flex field

25. Difference between Global segments and Context-Sensitive segments?

Ans. Gobal Segments: Global segments are segments that appear regardless of context. Columns used for global segments cannot hold an context-sensitive segments. Context-Sensitive segments: Context-Sensitive segments occur depending on the context.

26. Data conversion Vendor data effected tables?

Ans.

1. PO_VENDORS

2. PO_VENDOR_SITES_ALL

3. PO_VENDOR_CONTACTS

27. Data conversion Customer data effected tables?

Ans. 1. RA_CUSTOMERS_INTERFACE_ALL

2. RA_CUSTOMER_PROFILES_INT_ALL

28. AP Invoice conversion data effected tables?

Ans.1. AP_INVOICES_INTERFACE

2. AP_INVOICE_LINES_INTERFACE

29. Report Triggers?

Ans. 1. BEFORE PARAMETER FORM

2. AFTER PARAMETER FORM

3. BEFORE REPORT

4. BETWEEN PAGES

5. AFTER REPORT

The order of events when a report is executed is as follows:

1 Before Parameter Form trigger is fired.

2 Runtime Parameter Form appears (if not suppressed).

3 After Parameter Form trigger is fired (unless the user cancels from the Runtime Parameter Form).

4 Report is "compiled."

5 Queries are parsed.

6 Before Report trigger is fired.

7 SET TRANSACTION READONLY is executed (if specified via the READONLY argument or setting).

8 The report is executed and the Between Pages trigger fires for each page except the last one. (Note that data can be fetched at any time while the report is being formatted.) COMMITs can occur during this time due to any of the following-- user exit with DDL, SRW.DO_SQL with DDL, or if ONFAILURE=COMMIT, and the report fails.

9 COMMIT is executed (if READONLY is specified) to end the transaction.

10 After Report trigger is fired.

11 COMMIT/ROLLBACK/NOACTION is executed based on what was specified via the

ONSUCCESS argument or setting.

30. Define Alerts in Apps?

Ans. Oracle Alerts are used to monitor unusual or critical activity within a designateddatabase. The flexibility of ALERTS allows a database administrator the ability to monitor activities from tablespace sizing to activities associated with particular

applications (i.e. AP, GL, FA). Alerts can be created to monitor a process in the database and to notify a specific individual of the status of the process. There are 2 types of alerts: Event Alerts and Periodic Alerts

a) EVENT ALERTS are triggered when an event or change is made to a table in the

database.

b) PERIODIC ALERTS are activated on a scheduled basis to monitor database activities or

changes.

31. Steps to Create a Bit Map Report?

Ans.

1.Build the query

2.Draw the layout

3. Close the Layout Editor window. Under Data Model, open up the 'System Parameters'

4.Right Click on 'MODE' and select 'Properties' Enter 'BITMAP' as the 'Initial Value' and click OK. Save the report - call it 'first.rdf'.

5. Copy the report file in the appropriate directory.

6. Set the FORMAT to POSTSCRIPT and style as A4. in the concurrent program.

32. What is Token and used for?

Ans. Token in Concurrent Program creation : For a parameter in an Oracle Reports program, the keyword or parameter appears here. The value is case insensitive. For other types of programs, you can skip this field.

Procedure:

Defines an error token and substitutes it with a value. Calls to TOKEN( ) and RAISE( ) raise predefined errors for Oracle Workflow that are stored in the WF_RESOURCES table. The error messages contain tokens that need to be replaced with relevant values when

the error message is raised. This is an alternative to raising PL/SQL standard exceptions or custom-defined exceptions.

Syntax

procedure TOKEN

(token_name in varchar2,

token_value in varchar2);

33. Difference between function and procedure?

Ans. Procedures and functions consists of set of PL/SQL statements that are grouped together as a unit of solve a specific problem or perform set of related tasks. Procedures do not return values which functions return one One Value.

Packages: Packages provide a method of encapsulating and storing related procedures, functions, variables and other package contents.

34. Form registration setps?

Ans. 1. Create the form using the form builder.

2. Generate the executable code (.fmx)

3. Place the .fmb file in AU_TOP forms directory

4. Place the .fmx file in Module specific top forms directory.

5. Register the form with AOL

6. Associate a form function for the form

7. Attach the form function to a menu

35. Interface Tables details?

Ans.

1. General Ledger :            GL_INTERFACE

GL_INTERFACE_CONTROL

GL_INTERFACE_HISTORY

GL_BUDGET_INTERFACE

GL_DAILY_RATES_INTERFACE

2. Account Receivables:     AR_PAYMENTS_INTERFACE_ALL

AR_TAX_INTERFACE

HZ_PARTY_INTERFACE

HZ_PARTY_INTERFACE_ERRORS

RA_CUSTOMER_INTERFACE_ALL

RA_INTERFACE_DISTRIBUTIONS_ALL

RA_INTERFACE_ERROR_ALL

RA_INTERFACE_LINES_ALL

RA_INTERFACEA_SALESCREDITS_ALL

3. Account Payables:           AP_INTERFACE_CONTROL

AP_INTERFACE_REJECTION

                                                      AP_INVOICES_INTERFACE

AP_INVOICE_LINES_INTERFACE

4. Purchasing:                                 PO_DISTRIBUTIONS_INTERFACE

PO_HEADER_INTERFACE

PO_LINES_INTERFACE

PO_INTERFACE_ERROR

PO_REQUISITIONS_INTERFACE_ALL

36. Explain Tkprof?

Ans. TKProf converts the raw trace files into a more readable format

SYNTAX: TKProf tracefile outputfile [sort=option][explain=username/password]

Ex. TKProf a12345.trc mytrace.out explain scott/tiger

Tracefile The name of the trace statistics file, which is found in the user_dump_dest directory (Normally $ORACLE_HOME/rdbms/log)

Outputfile The name of the output file

Sort= [option1,option2,….] sorts the SQL statements in the output file

Explain=username/password instructs the TKProf to run explai on the SQL statement in order to explain the access path. This is essential for performance investigation

Sys=no TKProf skips recursive SQL and statements run as the SYS user. Used

rarely.

37. Adhoc Report?

Ans. You can define ad hoc financial reports as necessary to meet special reporting needs. An ad hoc report is one you define at the time you run financial reports. You do not assign a name to an ad hoc report. Instead, General Ledger automatically names ad hoc reports as follows: FSG-AD HOC-<Sequence Generated Number>.

Suggestion: We recommend that you delete ad hoc reports periodically to improve system performance.

Prerequisite : 1. Define a row set. 2. Define a column set.

To define and run an ad hoc financial report:

1. Navigate to the Run Financial Reports window.

2. Choose the Define Ad Hoc Report button.

3. Enter a name for your report Title. If this field is empty, the report title will default to the Row Set Description. If Row Set Description is empty, the report title will default to Row Set Name.

4. Enter the Row Set and Column Set to use for the report.

5. Enter any additional report information, including Budget, Encumbrance, and Currency control values.

6. Choose OK to return to the Run Financial Reports window.

38. Call_Form, Open_Form and New_Form Definitions?

Ans.

CALL_FORM: Runs an indicated form while keeping the parent form active. Form Builder runs the called form with the same Runform preferences as the parent form. When the called form is exited Form Builder processing resumes in the calling form at the point

from which you initiated the call to CALL_FORM. OPEN_FORM: Opens the indicated form. Use OPEN_FORM to create multiple-form

applications, that is, applications that open more than one form at the same time.

NEW_FORM: Exits the current form and enters the indicated form. The calling form is terminated as the parent form. If the calling form had been called by a higher form, Form Builder keeps the higher call active and treats it as a call to the new form. Form Builder releases memory (such as database cursors) that the terminated form was using. Form Builder runs the new form with the same Runform options as the parent form. If the parent form was a called form, Form Builder runs the new form with the same options as the parent form.

39. Form and Non-Form function?

Ans.

Form (Form Function): A form function (form) invokes an Oracle Forms form. Form functions have the unique property that you may navigate to them using the Navigate window.

Subfunction (Non-Form Function): A non-form function (subfunction) is a securable

subset of a form's functionality: in other words, a function executed from within a form.

Statement Printing AR

Source files : ARXGSP internally calling ARXSGPO

Tables Effected:

TEMP_ARSHR - AR_STATEMENT_HEADERS

TEMP_ARSLC - AR_STATEMENT_LINE_CLUSTERS

TEMP_ADJ - AR_ADJUSTMENT

HZ_CUST_ACCOUNTS

HZ_PARTIES

HZ_LOCATIONS

HZ_CUST_ACCT_SITES

HZ_PARTY_SITES

FND_TERRITORIES

Lookup Tables:

AR_LOOKUPS

AR_PAYMENT_SCHEDULES

Style – Group Above

Groups – Header Level

Call FND_CLIENT_INFO in Before Report Trigger

Landscape – 66 / 80 - Height / Width

AR Invoice Printing

Source File : RAXINV_SEL

Tables:

AR_INVOICE_HEADERS_V

AR_INVOICE_LINES_V

AR_TAX_LINES_V

Call FND_CLIENT_INFO in Before Report Trigger

FND_CLIENT_INFO.SET_ORG_CONTEXT(81);

Purchase Order Report

Source File : POXPRPOP

1) On Plane paper

2) Logo on Top Left

3) Move Address to center

4) Border for some fields

Tables:

PO_HEADERS_PRINT

PO_LINES_PRINT

Lookup Objects:

PO_LINE_LOCATIONS_PRINT

PO_VENDOR_CONTACTS

PO_DISTRIBUTIONS_ALL

HR_EMPLOYEES

HR_LOCATIONS

Check Printing

Source : APXPBFEL

1) Company Logo

2) No Check number

3) Stationary 8.5 X 11

Positive Pay

Source : APXPOPAY

Statement for bank

Date Check Numbers Amount Description

1-10 11 – 22 23 – 30 31 – 70

MM/DD/YY Number Number 9,2 Alpha Number

Left Right Left Left

General Report Modifications

a. Pre printed stationary

b. Portrait format

c. Header level changes

d. Line level changes

e. Decode usage

f. Zero ‘0’ suppressing

g. Plan paper - logo and address and borders