Sunday, 10 March 2019

Oracle Apps Techinical Questions

Oracle apps PLSQL interview questions 



1.                Difference b/w procedure and function?  A procedure may return (one or more values using OUT & INOUT Parameters) or may not return a value. But a function has to return a single value and has the return clause in its definition.
 ● Function can be called in select statements but procedure can only be called in a pl/sql block.  Procedure's parameters can have IN or OUT or INOUT parameters. But function's parameters can only have IN parameters.
2.                Difference b/w ROWID and ROWNUM? ROWID: It gives the hexadecimal string representing the address of a row.It gives the location in database where row is physically stored. ROWNUM: It gives a sequence number in which rows are retrieved from the database.
3.                Give some examples of pseudo columns? NEXTVAL, CURRVAL, LEVEL, SYSDATE
4.                Difference b/w implicit cursor and explicit cursor? Implicit cursors are automatically created by oracle for all its DML stmts. Examples of implicit cursors: SQL%FOUND, SQL%NOTFOUND, SQL%ROWCOUNT, SQL%ISOPEN; Explicit cursors are created by the users for multi row select stmts.
5.                How to create a table in a procedure or function? See the below piece of code:  Since create stmt can be used only at the sql prompt, we have used dynamic sql to create a table.            
DECLARE
                    L_STMT VARCHAR2(100);
BEGIN
                    DBMS_OUTPUT.PUT_LINE('STARTING ');
                    L_STMT := 'create table dummy1 (X VARCHAR2(10) , Y NUMBER)';
                    EXECUTE IMMEDIATE L_STMT;
                    DBMS_OUTPUT.PUT_LINE('end ');
END;

The above piece of code can be written In procedure and function DDL's can be used in function provided that function should be invoked in Begin-End block not from Select statement. Introduction to REF CURSOR


A REF CURSOR is basically a data type.  A variable created based on such a data type is generally called a cursor variable.  A cursor variable can be associated with different queries at run-time.  The primary advantage of using cursor variables is their capability to pass result sets between sub programs (like stored procedures, functions, packages etc.).
Let us start with a small sub-program as follows:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  en emp.ename%type;
begin
  open c_emp for select ename from emp;
  loop
      fetch c_emp into en;
      exit when c_emp%notfound;
      dbms_output.put_line(en);
  end loop;
  close c_emp;
end;

Let me explain step by step.  The following is the first statement you need to understand:
  type r_cursor is REF CURSOR;
The above statement simply defines a new data type called "r_cursor," which is of the type REF CURSOR.  We declare a cursor variable named "c_emp" based on the type "r_cursor" as follows:
  c_emp r_cursor;
Every cursor variable must be opened with an associated SELECT statement as follows:
  open c_emp for select ename from emp;
To retrieve each row of information from the cursor, I used a loop together with a FETCH statement as follows:
  loop
      fetch c_emp into en;
      exit when c_emp%notfound;
      dbms_output.put_line(en);
  end loop;

I finally closed the cursor using the following statement:
  close c_emp;
%ROWTYPE with REF CURSOR
In the previous section, I retrieved only one column (ename) of information using REF CURSOR.  Now I would like to retrieve more than one column (or entire row) of information using the same.  Let us consider the following example:
declare
  type r_cursor is REF CURSOR;
  c_emp r_cursor;
  er emp%rowtype;
begin
  open c_emp for select * from emp;
  loop
      fetch c_emp into er;
      exit when c_emp%notfound;
      dbms_output.put_line(er.ename || ' - ' || er.sal);
  end loop;
  close c_emp;
end;

In the above example, the only crucial declaration is the following:
  er emp%rowtype;
The above declares a variable named "er," which can hold an entire row from the "emp" table.  To retrieve the values (of each column) from that variable, we use the dot notation as follows:
      dbms_output.put_line(er.ename || ' - ' || er.sal);



6.  Explain the usage of WHERE CURRENT OF clause in cursors ? Look at the following pl/sql code:
DECLARE
                   CURSOR wip_cur IS
                   SELECT acct_no, enter_date
                   FROM wip
WHERE enter_date < SYSDATE -7
FOR UPDATE;
BEGIN
FOR wip_rec IN wip_cur
LOOP
                   INSERT INTO acct_log (acct_no, order_date)
                   VALUES (wip_rec.acct_no, wip_rec.enter_date);

                   DELETE FROM wip
WHERE CURRENT OF wip_cur;
          END LOOP;
END;
"WHERE CURRENT OF" has to be used in concurrence with "FOR UPDATE"  in the cursor select stmt.
"WHERE CURRENT OF" used in delete or update stmts means, delete/update the current record specified by the cursor.
By using WHERE CURRENT OF, you do not have to repeat the WHERE clause in the SELECT statement.

7.                What is the purpose of FORUPDATE? Selecting in FOR UPDATE mode locks the result set of rows in update mode, which means that row cannot be updated or deleted until a commit or rollback is issued which will release the row(s). If you plan on updating or deleting records that have been referenced by a Select For Update statement, you can use the Where Current Of statement.                                                                                                
8.                What is RAISE_APPLICATION_ERROR? The RAISE_APPLICATION_ERROR is a procedure defined by Oracle that allows the developer to raise an exception and associate an error number and message with the procedure other than just Oracle errors. Raising an Application Error With raise_application_error
9.                          
DECLARE
   num_tables NUMBER;
BEGIN
   SELECT COUNT(*) INTO num_tables FROM USER_TABLES;
   IF num_tables < 1000 THEN
      /* Issue your own error code (ORA-20101) with your own error message. 
         Note that you do not need to qualify raise_application_error with 
         DBMS_STANDARD */
      raise_application_error(-20101, 'Expecting at least 1000 tables');
   ELSE
      NULL; -- Do the rest of the processing (for the non-error case).
   END IF;
END;
/
The procedure RAISE_APPLICATION_ERROR lets you issue user-defined ORA- error messages from stored subprograms. That way, you can report errors to your application and
avoid returning unhandled exceptions.
9.                What is mutating error? Mutating error occurs in the following scenario:
WHEN WE ARE UPDATING A TABLE (TRIGGER WRITTEN ON A TABLE FOR UPDATE) AND AT THE SAME TIME TRYING TO RETRIEVE DATA FROM THAT TABLE. IT WILL RESULT INTO MUTATING TABLE AND IT WILL RESULT INTO MUTATING ERROR. 

10.             Can we have commit/rollback in DB triggers? Having Commit / Rollback inside a trigger defeats the standard of whole transaction's commit / rollback all together. Once trigger execution is complete then only a transaction can be said as complete and then only commit should take place. If we still want to carry out some action which should be initiated from trigger but should be committed irrespective of trigger completion / failure we can have AUTONOMUS TRANSACTION. Inside Autonomous transaction block we can have Commit and it will act as actual commit.                                                                                                 
11.             Can we make the trigger an autonomous transaction? This makes all the difference because within the autonomous transaction (the trigger), Oracle will view the triggering table as it was before any changes occurred—that is to say that any changes are uncommitted and the autonomous transaction doesn’t see them. So the potential confusion Oracle normally experiences in a mutating table conflict doesn’t exist.
12.             What is autonomous transaction? Autonomous transaction means a transaction that is embedded in some other transaction, but functions independently.
13.             What is a REF Cursor? The REF CURSOR is a data type in the Oracle PL/SQL language. It represents a cursor or a result set in Oracle Database.
14.             What is the difference between ref cursors and normal pl/sql cursors?
   Declare
          type rc is ref cursor;
          cursor c is
          select * from dual;
          l_cursor rc;
       begin
          if ( to_char(sysdate,'dd') = 30 ) then
                   open l_cursor
                             for select * from emp;
          elsif ( to_char(sysdate,'dd') = 29 ) then
                   open l_cursor
                             for select * from dept;
          else
                   open l_cursor
                             for select * from dual;
          end if;
          open c;
      end;                                                                                                                    
Given that block of code you see perhaps the most "salient" difference, no matter how many times you run that block The cursor C will always be select * from dual.  The ref cursor can be anything.

15.             Is Truncate a DDL or DML statement? And why? Truncate is a DDL statement. Check the LAST_DDL_TIME on USER_OBJECTS after truncating your table. TRUNCATE will automatically commit, and it's not rollback able. This changes the storage definition of the object. That's why it is a DDL.
16.             What are the actions you have to perform when you drop a package? If you rename a package, the other packages that use it will have to be MODIFIED. A simple compilation of the new renamed package won't do. If you have toad, go to the "used by" tab that will show you the packages that call the package being renamed.
17.             What is cascading triggers? When a trigger fires, a SQL statement within its trigger action potentially can fire other triggers, resulting in cascading triggers.
18.             What are materialized views? A materialized view is a database object that stores the results of a query (possibly from a remote database). Materialized views are sometimes referred to as snapshots.
19.  Example
If the materialized view will access remote database objects, we need to start by creating a database link to the remote DB:

CREATE DATABASE LINK remotedb
CONNECT TO scott IDENTIFIED BY tiger
USING 'orcl';

Now we can create the materialized view to pull in data (in this example, across the database link):

CREATE MATERIALIZED VIEW items_summary_mv
 ON PREBUILT TABLE
 REFRESH FORCE  AS
 SELECT  a.PRD_ID, a.SITE_ID, a.TYPE_CODE, a.CATEG_ID,
        sum(a.GMS)       GMS,
        sum(a.NET_REV)   NET_REV,
        sum(a.BOLD_FEE)  BOLD_FEE,
        sum(a.BIN_PRICE) BIN_PRICE,
        sum(a.GLRY_FEE)  GLRY_FEE,
        sum(a.QTY_SOLD)  QTY_SOLD,
        count(a.ITEM_ID) UNITS
FROM  items@remotedb a
GROUP BY  a.PRD_ID, a.SITE_ID, a.TYPE_CODE, a.CATEG_ID;

Materialized view logs:
Materialized view logs are used to track changes (insert, update and delete) to a table. Remote materialized views can use the log to speed-up data replication by only transferring changed records.
Example:
CREATE MATERIALIZED VIEW LOG ON items;
20.             Commonly occurring Errors in Reports?
Some of the errors are defined below
1. There Exists uncompiled unit: When the report is not compiled before loading in the Oracle Applications.
2. Report File not found: When the rdf is not uploaded in proper directory
3. Width or margin is zero: When the repeating frame is not within proper frames
4. Not in proper group: When the repeating frame is not referred to proper group
21.             What is the difference between Compile and Incremental Compile in oracle reports?
In Full compile all the PL/SQL within the reports are compiled but in incremental compile only the changed PL/SQL units are compiled.
When compiling the report for the first time, we should do the full compilation and not the Incremental compile.

22.             How to compile Procedures and Packages?
ALTER <proc/package> <name>COMPILE;

Oracle apps PLSQL interview questions 


1)    What is ERP? 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.

Conventional: The conventional path loader essentially loads the data by using standard ‘insert’ statement.
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,”oracleapps4u”,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 to 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 theUTL_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);
Utl_file.fclose(fp);
End;
4)    What is SET-OF-BOOKS? Collection of Chat of Accounts and Currency and Calendars is called SOB

5)    What is the interface Table? Interface Table is a table which is used as medium for transfer of data between two systems.

6)    What is invoice?  A request sent 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)    What are the Base tables in the AR?
9)    What are the interface tables of the customer conversion? Check the following blog post for interface tables in customer Interfaces and Conversions in Oracle Applications

Order Import Interface (Sales Order Conversion)
Pre-requisites:
Order Type
Line Type
Items
Customers
Ship Method/ Freight Carrier
Sales Person
Sales Territories
Customer Order Holds
Sub Inventory/ Locations
On hand Quantity
Interface tables:
OE_HEADERS_IFACE_ALL
OE_LINES_IFACE_ALL
OE_ACTIONS_IFACE_ALL
OE_ORDER_CUST_IFACE_ALL
OE_PRICE_ADJS_IFACE_ALL
OE_PRICE_ATTS_IFACE_ALL
Concurrent Program:
Order Import
Base tables:
OE_ORDER_HEADERS_ALL
OE_ORDER_LINES_ALL
Pricing tables: QP_PRICING_ATTRIBUTES
Order Import API OE_ORDER_PUB.GET_ORDER and
PROCESS_ORDER can also be used to import orders.


Item import (Item conversion)
Pre-requisites:
Creating an Organization
Code Combinations
Templates
Defining Item Status Codes
Defining Item Types
Interface tables:
MTL_SYSTEM_ITEMS_INTERFACE
MTL_ITEM_REVISIONS_INTERFACE (If importing revisions)
MTL_ITEM_CATEGORIES_INTERFACE (If importing categories)
MTL_INTERFACE_ERRORS (View errors after import)
Concurrent Program:
Item import
Base Tables:
MTL_SYSTEM_ITEMS_B
MTL_ITEM_REVISIONS_B
MTL_CATEGORIES_B
MTL_CATEGORY_SETS_B
MTL_ITEM_STATUS
MTL_ITEM_TEMPLATES


Inventory On-hand quantity Interface
Interface tables:
MTL_TRANSACTIONS_INTERFACE
MTL_MTL_TRANSACTION_LOTS_INTERFACE (If the item is Lot
Controlled)
MTLL_SERIAL_NUMBERS_INTERFACE (If the item is Serial
Controlled)
Concurrent Program:
Launch the Transaction Manager through Interface Manager or explicitly call the API – INV_TXN_MANAGER_PUB.PROCESS_TRANSACTIONS () to launch a dedicated transaction worker to process them.
Base Tables:
MTL_ON_HAND_QUANTITIES
MTL_LOT_NUMBERS
MTL_SERIAL_NUMBERS


Customer conversion
Interface tables:
RA_CUSTOMERS_INTERFACE_ALL
RA_CUSTOMER_PROFILES_INT_ALL
RA_CONTACT_PHONES_INT_ALL
RA_CUSTOMER_BANKS_INT_ALL
RA_CUST_PAY_METHOD_INT_ALL
Base tables:
RA_CUSTOMERS
RA_ADDRESSES_ALL
RA_CUSTOMER_RELATIONSHIPS_ALL
RA_SITE_USES_ALL
Concurrent program:
Customer Interface


Auto Invoice interface
Pre-requisites:
Set of Books
Code combinations
Items
Sales representatives
Customers
Sales Tax rate
Payment Terms
Transaction Types
Freight Carriers
FOB
Batch Sources
Accounting Rules
Interface tables:
RA_INTERFACE_LINES_ALL
RA_INTERFACE_SALESCREDITS
RA_INTERFACE_DISTRIBUTIONS
RA_INTERFACE_ERRORS (details about the failed records)
Base tables:
RA_BATCHES
RA_CUSTOMER_TRX_ALL
RA_CUSTOMER_TRX_LINES_ALL
AR_PAYMENT_SCHEDULES_ALL
RA_CUSTOMER_TRX_LINE_SALESREPS
RA_CUST_TRX_GL_DIST_ALL
RA_CUSTOMER_TRX_TYPES_ALL
Concurrent Program:
Auto invoice master program


AR Receipt API
Pre-requisites:
Set of Books
Code combinations
Items
Quick Codes
Sales representatives
Customers
Sales Tax rate
API:
AR_RECEIPT_API_PUB.CREATE_CASH
AR_RECEIPT_API_PUB.CREATE_AND_APPLY
Base tables:
AR_CASH_RECEIPTS


AP invoice interface
Pre-requisites:
Set of Books
Code combinations
Employees
Lookups
Interface tables:
AP_INVOICES_INTERFACE
AP_INVOICE_LINES_INTERFACE
Base tables:
AP_INVOICES_ALL – header information
AP_INVOICE_DISTRIBUTIONS_ALL – lines info
Concurrent program:
Payables Open Interface Import


Vendor conversion/interface
Pre-requisites setup’s required:
Payment terms
Pay Groups
CCID
Supplier classifications
Bank Accounts
Employees (if employees have to set up as vendors)
Interface tables:
AP_SUPPLIERS_INT
AP_SUPPLIER_SITES_INT
AP_SUP_SITE_CONTACT_INT
Base Tables:
PO_VENDORS
PO_VENDOR_SITES_ALL
PO_VENDOR_CONTACTS
Interface programs:
Supplier Open Interface Import
Supplier Sites Open Interface Import
Supplier Site Contacts Open Interface Import


Purchase Order conversion:
Pre-requisites:
Suppliers, sites and contacts
Buyers
Line Types
Items
PO
Charge account setup
Interface Tables:
PO_HEADERS_INTERFACE
PO_LINES_INTERFACE
PO_DISTRIBUTIONS_INTERFACE
PO_INTERFACE_ERRORS (Fallouts)
Interface Program:
Import Standard Purchase Orders.
Base Tables:
PO_HEADERS_ALL
PO_LINES_ALL
PO_DISTRIBUTIONS_ALL
PO_LINE_LOCATIONS_ALL


Import Blanket Purchase Agreements:
Interface Tables:
PO_HEADERS_INTERFACE
PO_LINES_INTERFACE
Interface program:
Import Price Catalogs
Base tables:
PO_HEADERS_ALL
PO_LINES_ALL
PO_LINE_LOCATIONS_ALL


Requisition import
Pre-requisites:
Set of Books
Code combinations
Employees
Items
Define a Requisition Import Group-By method in the Options window.
Associate a customer with your deliver-to location using the Customer
Address window for internally sourced requisitions.
Interface tables:
PO_REQUISITIONS_INTERFACE_ALL
PO_REQ_DIST_INTERFACE_ALL
Base tables:
PO_REQUISITIONS_HEADERS_ALL
PO_REQUISITION_LINES_ALL
PO_REQ_DISTRIBUTIONS_ALL
Concurrent program:
REQUISITION IMPORT

PO Receipts Interface
Pre-requisites:
Set of Books
Code combinations
Employees
Items
Interface tables:
RCV_HEADERS_INTERFACE
RCV_TRANSACTIONS_INTERFACE
PO_INTERFACE_ERRORS
Concurrent program:
RECEIVING OPEN INTERFACE
Base tables:
RCV_SHIPMENT_HEADERS
RCV_SHIPMENT_LINES
RCV_TRANSACTIONS

GL Journal interface
Pre-requisites:
Set of Books
Flex field Value sets
Code Combinations
Currencies
Categories
Journal Sources
Interface tables:
GL_INTERFACE
Base tables:
GL_JE_HEADERS
GL_JE_LINES
GL_JE_BACTHES
Concurrent Program:
Journal Import
Journal Posting --- populates GL_BALANCES

GL budget interface
Pre-requisites:
Set of Books
Flex field Value sets
Code Combinations
Interface tables:
GL_BUDGET_INTERFACE
Base tables:
GL_BUDGETS
GL_BUDGET_ASSIGNMENTS
GL_BUDGET_TYPES
Concurrent program:
Budget Upload

GL daily conversion rates
Pre-requisites:
Currencies
Conversion rate Types
Interface tables:
GL_DAILY_RATES_INTERFACE
Base tables:
GL_DAILY_RATES
GL_DAILY_CONVERSION_TYPES
Concurrent Program:
You do not need to run any import programs. The insert, update, or deletion of rates in GL_DAILY_RATES is done automatically by database triggers on the GL_DAILY_RATES_INTERFACE. All that is required is to develop program to populate the interface table with daily rates information


10)  What is the procedure to develop an interface?           
·         First we will get the Requirement document.
·         We will create control file based on that plot file.
·         Then the control files which loads the data into staging tables.
·         Through pl/sql programs we will mapping and validate the data and then dump into the interface tables.
·         through the standard programs we will push the data from interface tables to Base tables.
11)  What are the validations in customer interface?
·         customer name : The same customer reference can’t have different customer names          with in this table HZ_PARTIES.PARTY_NAME
·         customer numbermust 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
·         customer status : must be ‘A’ for active or ‘I’ for inactive
                                                HZ_PARTIES_STATUS
·         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
·         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.
12) How to submit a concurrent program from sql or pl/sql code?
              FND_REQUEST.SUBMIT_REQUEST (‘PO’,’EXECUTABLE NAME’,,,, PARAMETERS)
13)  List out some APIs?
FND_FILE.PUTLINE(FND_FILE.LOG)
FND_FILE.PUTLINE(FND_FILE.OUTPUT)
14) What are profile options?
It is some set of options based on which the Functional and Technical behavior of Oracle Applications depends.
             
EX: - I want to assign the user3 responsibility to p4 printer then
                         System Administrator > Profile ร System
                                    (FND_PROFILE_OPTIONS) 
    15) What are the User PARAMETERS in the Reports?
·         P_CONC_REQUEST_ID
·         P_FLEX_VALUE
16)  What are FND USER EXITS in oracle reports?
User exits in oracle reports:
A User Exit is an API, which provides a way to pass control from Reports Builder to a 3GL program that performs some function, and then returns control to Reports Builder.

Using these we can integrate Oracle reports with Oracle apps AOL, and run them as concurrent programs.
Following are the user exits available in Oracle Reports that makes the AOL integration:
FND SRWINIT
FND SRWEXIT
FND FORMAT_CURRENCY
FND FLEXIDVAL
FND FLEXSQL

When the concurrent manager runs an Oracle Report concurrent request, it passes the concurrent request id in the P_CONC_REQUEST_ID parameter. When you call the FND SRWINIT user exit in the report's Before Report trigger, the user exit uses the passed request id to query the Oracle Applications context that the concurrent request was submitted in (via the FND_CONCURRENT_REQUESTS table) and then log on with that context. 
This allows you to use operating specific views, access profile option values, etc within your report. You should also call the FND SRWEXIT user exit in the After Report trigger.

If you try calling the FND SRWINIT user exit in your report without the P_CONC_REQUEST_ID parameter defined as a user parameter on your report, the user exit will fail.

    17)  What are the two parameters that are mandatory for pl/sql type concurrent prog?         
          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.
    18) What are different validation types in value sets?
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. 
19) What is the sequence of execution of different clause in a select statement?    

Sequence of SQL statement processed

When a query is submitted to the database, it is executed in the following order:
FROM clause
WHERE clause
GROUP BY clause
HAVING clause
SELECT clause
ORDER BY clause

So why is it important to understand this?
When a query is executed, First all the tables and their join conditions are executed filtering out invalid references between them.
Then the WHERE clause is applied which again filters the records based on the condition given. Now you have handful of records which are GROUP-ed
And HAVING clause is applied on the result. As soon as it is completed, the columns mentioned are selected from the corresponding tables. And finally sorted using ORDER BY clause. So when a query is written it should be verified based on this order, otherwise it will lead wrong result sets.

Example:
Recently I came across the following problem.

The original query was
SELECT DISTINCT so.departure_airport, so.airport_name
FROM special_offers so, special_offers_groups_join sogj
WHERE so.resort_code = '000170' AND so.accomodation_code = '015397'
AND so.departure_date = '2008-01-13'
AND so.nights = '7'
AND sogj.group_id = '1'
AND sogj.special_offer_id = so.special_offer_id
ORDER BY price ASC

Table data:
departure_airport airport_name price
'MAN' 'Manchester Airport' 344
'MAN' 'Manchester Airport' 288
'MAN' 'Manchester Airport' 316
'BRS' 'Bristol' 289
'BRS' 'Bristol' 345
'BRS' 'Bristol' 317
'BHX' 'Birmingham Airport' 343
'BHX' 'Birmingham Airport' 287
'BHX' 'Birmingham Airport' 315
Here the query is executed as follows:
All the records from both the tables are taken.
Conditions mentioned in the WHERE
   
20)  Form development process?
1.      open template form
2.      Save as <your form>.fmb
3.      Change the form module name as form name.
4.      Delete the default blocks, window, and canvas
5.      Create a window.
6.      Assign the window property class to window
7.      Create a canvas   (subclass info)
8.      Assign canvas property class to the canvas
9.      assign the window to the canvas and canvas to the window
10.  Create a data block       
11.  Modify the form level properties. (sub class item ร  Text item)
12.  Modify the app_custom package in the program unit.
13.  Modify the pre-form trigger (form level)
14.  Modify the module level properties ((console window, First navigation
15.  Save and compile the form.
16.  Place the .fmx in the server directory.
17.  Register in the AOL
                                    APPLICATION -> FORM
                                    APPLICATION -> FUNCTION
                                    APPLICATION -> MENU
21)  How to customize the Reports?
·         Identify the Short name of the report and the module in which we have to place the customization
§         Ex: - if you want to customize in the AR module, path is
Appl top\ar\11.5.0\reports\US\ .rdf
·         FTP back the file to the local system in Binary mode
·         Open the .rdf file in Report builder and change the name of the module.
·         Open the data model and Layout mode, perform all the required changes.
·         Go to report wizard and select the newly created columns.
·         Compile it. Save it.
·         Then Register in the AOL          Concurrent > executable.
Concurrent > program.
·         Go to system administrator Security > Responsibility > request
·         Add and assign a concurrent program to a request group

22)  List some report names in oracle apps?
1)   OPEN-DEBIT MEMO REPORT?
This report shows all the open-debit memo transactions, based oncustomer 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 POSITIVE PAY 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?
This report 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

23)  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.

24) What are ‘WHO’ Columns in oracle apps tables?
        1) Created by
        2) Creation date
        3) Last _updated by
        4) last_update_date
        5) last_update_value
25) What are FLEX FIELDS?
            Flexfields are used to capture the additional business information.
                DFF
                    KFF
Additional
Unique Info, Mandatory
Captured in attribute prefixed columns
Segment prefixed
Not reported on standard reports
Is reported on standard reports
To provide expansion space on your form With the help of []. [] Represents descriptive Flex field.

FLEX FILED : DESCRIPTIVE : REGIGSTER
Used for entering and displaying key information
For example Oracle General uses a key Flex field called Accounting Flex field to
Uniquely identifies a general account.
FLEX FILED : KEY : REGIGSTER
  
Oracle 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,  
26)  What are different concurrent requests?
 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.
27)  What are the activities in Sys Admin Module?
            a) Define Custom Users, b) Define Login Users, c) Register oracle DB users,
            d) Define Concurrent Programs, e) Register Concurrent Executable, 
            f) Setting Profile Option Values, g) Define Request Types.
28) What activities can be performed in 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 
29) What are the type Models in the system parameters of the report?
     1) Bit map       2) Character mode
30) 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

SRW.SET_attributes


Description The SRW.SET_<attributes> procedures are used to set the format attributes. Mainly used to make some change in the appearance of the layout objects.

Format attributes
Value
Text Color
Red
Font Face
Impact
Font Weight
Bold
Font Style
Italic
Font Pattern
Solid diamond

Example
Function age_mask return Boolean is
Begin
If :age < 25 then
Srw.set_text_color(‘Red’);
Srw.set_font_face(‘Impact’) ;
Srw.set_font_weight(srw.bold_weight) ;
Srw.set_font_style(srw.italic_style);
Srw.set_fill_pattern(‘solid diamond’);
End if;
End;
SRW.SET_MAXROW

Description This procedure sets the maximum number of records to be fetched for the specified query. This is useful when your report formats (i.e., displays) fewer records than the query (or queries) that fetch them. Thus, with SRW.SET_MAXROW, you can conditionally restrict data that is fetched for your report, enabling you to improve the report's performance.

Syntax
SRW.SET_MAXROW (query_name CHAR, maxnum PLS_INTEGER);

Parameters
query_name  Is the query whose fetched records will be limited.
maxnum       Is maximum number of records you want the query to fetch.

Property Palette To define this attribute using the Property Palette, set the Maximum Rows to Fetch property.

Restrictions
<!--[if !supportLists]-->· <!--[endif]-->SRW.SET_MAXROW is only meaningful in a Before Report trigger (i.e., after the query is parsed). If SRW.SET_MAXROW is called after the Before Report trigger (i.e., after the queries have been executed), the SRW.MAXROW_UNSET packaged exception is raised.
<!--[if !supportLists]-->· <!--[endif]-->Because this procedure causes only the specified number of records to be fetched, the "unfetched" records of the query are not used in computations, etc.
<!--[if !supportLists]-->· <!--[endif]-->If you specify that 0 records should be fetched, the query will still be parsed.


Example
/* Suppose your report has two queries, Q_Stocks and Q_Bonds.
** Suppose also, that you have a user-created parameter, named
** WHICHDATA, that enables users to specify which data they want
** the report to display: either stocks or bonds. In the
** Before Report trigger, you could use the SRW.SET_MAXROW
** procedure to ensure that only one query's data is fetched:
*/

FUNCTION FETCHIT RETURN BOOLEAN IS
BEGIN
if :whichdata != 1 then
srw.set_maxrow ('Q_Stocks', 0);
else
srw.set_maxrow ('Q_Bonds', 0);
end if;
RETURN (TRUE);
END;

SRW.RUN_REPORT

Description This procedure invokes RWRUN60 with the string that you specify.
This procedure is useful for:

  • · running drill-down reports (i.e., calling a report from a button's action trigger)
  • · sending parts of a report to different recipients (e.g., to send a report via e-mail to each manager with just his or her group's data)
  • · sending parts of a report to different printers (e.g., to send each manager's report to his or her printer)
  • · running multiple reports from a single "driver" report
<!--[if !supportLists]-->
SRW.RUN_REPORT executes the specified RWRUN60 command.

Syntax
SRW.RUN_REPORT (command_line CHAR);

Parameters
command_line         Is a valid RWRUN60 command.

Restrictions
<!--[if !supportLists]-->· <!--[endif]-->If you want parameter values that are entered on the Runtime Parameter Form to be passed in the RWRUN60 string, you must call SRW.RUN_REPORT after the before form trigger.
<!--[if !supportLists]-->· <!--[endif]-->The string that is specified for or passed to this procedure must follow the syntax and case-sensitivity rules for your operating system.

<!--[if !supportLists]-->· <!--[endif]-->No userid should be specified for the SRW.RUN_REPORT procedure. The userid is inherited by the "calling" report.

<!--[if !supportLists]-->· <!--[endif]-->If the parent report that invokes SRW.RUN_REPORT is run in batch, then DESTYPE can only be File, Printer, Sysout, or Mail. Otherwise, DESTYPE can be File, Printer, or Mail.
<!--[if !supportLists]-->·
<!--[endif]--> If SRW.RUN_REPORT is used in the PL/SQL for a button, the Runtime Parameter Form will not appear by default when the button is selected. If you want the Runtime Parameter Form to appear, you must specify PARAMFORM=YES in the call to SRW.RUN_REPORT.

<!--[if !supportLists]-->· <!--[endif]-->If you do not specify a path, Report Builder will use its file path search order to find the report.

Example
/* Suppose you have the following two reports: MGR_RUN, which queries manager names, and invokes a second report named MAIL_IT. MAIL_IT, which queries employee names for the manager that MGR_RUN passes it, and sends the report output to the manager via e-mail. The description of MGR_RUN could be as follows:
** Query: SELECT ENAME, EMPNO FROM EMP WHERE JOB='MANAGER'
** Group Filter:
*/
FUNCTION FOO RETURN BOOLEAN IS
BEGIN
srw.run_report('report=MAIL_IT
desname='||:ename ||' desformat=dflt batch=yes
mgr_no='|| TO_CHAR(:empno) );
RETURN (TRUE);
EXCEPTION
when srw.run_report_failure then
srw.message(30, 'Error mailing reports.');
raise srw.program_abort;
END;
/* This PL/SQL invokes MAIL_IT, specifies that MAIL_IT's output
** should be sent to the manager via Oracle Mail, and passes the
** manager number, so that the MAIL_IT report can query only the
** manager's employees.
** Note: EMPNO's values must be converted to characters
** (TO_CHAR in the PL/SQL above), because SRW.RUN_REPORT
** requires a character string.
** Layout: None is needed, because this report only fetches data,
** then passes it to a second report.
** The description of MAIL_IT could be as follows:
** Query: SELECT DEPTNO, ENAME, SAL FROM EMP WHERE MGR=:MGR_NO
** Layout: Master/Detail
*/

/* Suppose that you have three reports that you almost always run together.
** The reports are named SALARY, COMMISS, and TAXES. To run these reports
** with one RWRUN60 command, you create a driver report named PAYROLL.
** The description of PAYROLL could be as follows:
** Query: SELECT DEPTNO FROM DEPT
** Before Report Trigger:
*/


FUNCTION FOO RETURN BOOLEAN IS
BEGIN
srw.run_report('batch=yes report=SALARY
destype=file desformat=dflt desname=salary.lis');
srw.run_report('batch=yes report=COMMISS
destype=file desformat=dflt desname=comiss.lis');
srw.run_report('batch=yes report=TAXES
destype=file desformat=dflt desname=comiss.lis');
RETURN (TRUE);
END;


/* Layout: Tabular
** When you run PAYROLL from the designer or RWRUN60, the other three
** reports will all be run. (Note that, in this case, the query and
** the layout for Payroll could be anything. They are only used here
** in order to make it possible to run PAYROLL.)
*/
SRW.USER_EXIT


Description This procedure calls the user exit named in user_exit_string. It is useful when you want to pass control to a 3GL program during a report's execution.

Syntax         SRW.USER_EXIT (user_exit_string CHAR);

Parameters
user_exit_string       Is the name of the user exit you want to call and any columns or parameters that you want to pass to the user exit program.

Restrictions
User exits are not portable. If your report must be portable, and you need to add conditional logic to it, use PL/SQL.

If the user exit string passes a column or parameter to the user exit program, SRW.REFERENCE
must be called before this procedure.

Example
/* Suppose you have a user exit named STORE to which you want ** to pass salary values from Report Builder. To do so, you ** could write the following formula. For more information on ** how to call user exits, see Calling a user exit. */
FUNCTION FOO RETURN BOOLEAN IS
BEGIN
IF :SAL >= 0 THEN
SRW.REFERENCE(:SAL);
SRW.USER_EXIT('STORE SAL');
ELSE
SRW.MESSAGE(100, 'FOUND A NEGATIVE SALARY. CHECK THE
          EMP TABLE.');
END IF;
EXCEPTION
WHEN SRW.UNKNOWN_USER_EXIT THEN
SRW.MESSAGE(200, 'STORE USER EXIT WAS UNKNOWN.
CHECK IF IT''S LINKED.');
WHEN SRW.USER_EXIT_FAILURE THEN
SRW.MESSAGE(200, 'STORE USER EXIT FAILED.
CHECK ITS CODE.');
RETURN(TRUE);
END;

SRW.REFERENCE


Description This procedure causes Report Builder to add the referenced object to the PL/SQL construct's dependency list. This causes Report Builder to determine the object's value just before firing the PL/SQL construct. This is useful when you want to ensure that a column value
passed to a user exit is the most recently computed or fetched value.

Syntax SRW.REFERENCE (:object CHAR|DATE|NUMBER);

Parameters
object Is the Report Builder parameter or column whose value needs to be ascertained before the
construct fires.

Restrictions
The colon is required before the object name.
SRW.REFERENCE is unnecessary when the object is already referenced in the current PL/SQL construct.

Example
/* Suppose you want to pass the temperature and pressure values ** to a user exit called SUPERHEAT. Suppose, also, that if the ** temperature is too low, you want to raise a customized error message. ** To do so, you could write the following formula:*/
FUNCTION EXIT RETURN BOOLEAN IS
BEGIN
if :temp > 0 then
srw.reference (:temp); -- unnecessary reference
srw.reference (:pressure);
srw.user_exit('superheat temp pressure');
else srw.message(1000, 'Temperature is below
normal. Is machine off?');
raise srw.program_abort;
end if;
RETURN(TRUE);
END;

SRW.PROGRAM_ABORT

Description This exception stops the report execution and raises the following error message:
REP-1419: PL/SQL program aborted.

SRW.PROGRAM_ABORT stops report execution when you raise it.

Syntax         SRW.PROGRAM_ABORT;

Usage Notes You must raise the exception from within your PL/SQL.

Example
/* Suppose you want to put a border around the salary if it is greater than 0.
** Suppose, also, that if the report fetches a salary less than 0, you want to
** raise a customized error message (i.e., "FOUND A NEGATIVE SALARY. . ."),
** then terminate the report execution. To do so, you could write the
** following format trigger for F_SAL.
*/

FUNCTION foo return boolean is
BEGIN
if :sal >= 0 then
srw.attr.mask := SRW.BORDERWIDTH_ATTR;
srw.attr.borderwidth := 1;
srw.set_attr (0, srw.attr);
else
srw.message(100, 'FOUND A NEGATIVE SALARY.
CHECK THE EMP TABLE.');
raise srw.program_abort;
end if;
RETURN (TRUE);
END;

SRW.MESSAGE

Description This procedure displays a message with the message number and text that you specify. The message is displayed in the format below. After the message is raised and you accept it, the report execution will continue.
MSG-msg_number: msg_text.

Syntax
SRW.MESSAGE (msg_number NUMBER, msg_text CHAR);

Parameters
msg_number Is a number from one to ten digits, to be displayed on the message line. Numbers less than five digits will be padded with zeros out to five digits. For example, if you specify 123, it will be displayed as SRW-00123.

msg_text      Is at most 190 minus the msg_number alphanumeric characters to be displayed on the message line.

Restrictions
<!--[if !supportLists]-->· <!--[endif]-->You cannot trap nor change Report Builder error messages.
<!--[if !supportLists]-->· <!--[endif]-->SRW.MESSAGE does not terminate the report execution; if you want to terminate a report after raising a message, use SRW.PROGRAM_ABORT.
<!--[if !supportLists]-->· <!--[endif]-->Any extra spaces in the message string will be displayed in the message; extra spaces are not removed by Report Builder.

Example
/* Suppose you have a user exit named MYEXIT to which you want to
** pass the values of the SAL column. Suppose, also, that you want
** to raise your own error if the user exit is not found (e.g., because
** it is not linked, compiled, etc.). To do these things, you could
** write the following PL/SQL in the Format Trigger of the F_SAL field:
*/

/* This trigger will raise your message as follows:
** MSG-1000: User exit MYEXIT failed. Call Karen Smith x3455.
*/

FUNCTION FOO RETURN BOOLEAN IS
BEGIN
srw.reference(:SAL);
srw.user_exit('myexit sal');
EXCEPTION
when srw.unknown_user_exit then
srw.message(1000, 'User exit MYEXIT failed.
Call Karen Smith x3455.');
raise srw.program_abort;
RETURN (TRUE);
END;

SRW.GET_PAGE_NUM

Description This procedure returns the current page number. This is useful when you want to use the page number in the field's Format Trigger property.

Syntax
SRW.GET_PAGE_NUM (page_num);

Parameters
page_num     Is the variable in which you want to place the current page number.

Returns        The current page number.

Restrictions
SRW.GET_PAGE_NUM is only meaningful in a format trigger. It has no effect when entered in other places.


Example
/* Suppose you want to perform a computation based upon a page number.
** In the field's Format Trigger, you could use SRW.GET_PAGE_NUM function:
*/

BEGIN
DECLARE PAGE_NUM NUMBER;
begin
srw.get_page_num (page_num);
srw.set_field_num (0, page_num + 3);
end;
END;

SRW.GETERR_RUN


Description This function returns an error message if Report Builder detects an error while running the SRW.RUN_REPORT procedure.
Syntax         SRW.GETERR_RUN;
Returns An error message.

Example
/* Suppose you are sending parts of a report to users via Oracle*Mail. ** For more information, see "SRW.RUN_REPORT". Also, ** suppose that if SRW.RUN_REPORT fails, you want to display a message ** that explains why it failed. Your PL/SQL could look like this:*/
BEGIN
DECLARE TMP CHAR(100);
begin
srw.run_report('batch=yes report=send.rdf
destype=file desname=send.lis desformat=dflt');
exception when srw.run_report_failure then
tmp := srw.geterr_run;
srw.message(1000, tmp);
end;
END;

SRW.DO_SQL_FAILURE


Description This exception stops the report execution and raises the following error message:
REP-1425: Error running DO_SQL package - REP-msg ORA-msg
where:
REP-msg       Is a Report Builder message.
ORA-msg      Is an optional ORACLE message, providing more information on the Report Builder message.

Syntax
SRW.DO_SQL_FAILURE;

Usage Notes Report Builder raises this exception when the SRW.DO_SQL packaged procedure fails (e.g., if the user does not have DDL privileges, yet tries to create a table with SRW.DO_SQL).

Example
/* Suppose you want your own error message raised,
** instead of the default error message.
** You could handle this exception in the following way:
*/

EXCEPTION
when SRW.DO_SQL_FAILURE then
srw.message(1000, 'Error occurred while creating
table CHECKS.');

SRW.DO_SQL


Description This procedure executes the specified SQL statement from within Report Builder. The SQL statement can be DDL (statements that define data), or DML (statements that manipulate data). DML statements are usually faster when they are in PL/SQL, instead of in SRW.DO_SQL.

Since you cannot perform DDL statements in PL/SQL, the SRW.DO_SQL packaged procedure is especially useful for performing them within Report Builder, instead of via a user exit. For more information on DDL or DML statements, see the ORACLE8 Server SQL Language Reference Manual.

Syntax         SRW.DO_SQL (sql_statement CHAR);

Parameters
sql_statement         Is any valid SQL statement. Remember to precede any Report Builder object names with a colon (:).

Restrictions
<!--[if !supportLists]-->· <!--[endif]-->In Report trigger order of execution, notice where the SET TRANSACTION READONLY occurs.

<!--[if !supportLists]-->· <!--[endif]-->A bind variable's value can be at most 64,000 bytes. (When the value exceeds that limit, it will be truncated to the left-most 64,000 bytes.)

<!--[if !supportLists]-->· <!--[endif]-->If you use a parameter as the destination of a character column for an INTO clause, you should ensure that the parameter is wide enough to contain the selected values. For example, suppose that you have the SRW.DO_SQL statement below: The destination parameter (my_ename) needs a width that is equal to the maximum width of the ENAME column. The reason for this is that the selected value contains trailing spaces up to the assumed size of the value. If the parameter is not large enough, you will get a truncation exception. If you are not sure about the maximum width of the SELECT list item, then you should use 2000 as the width for the parameter.

srw.do_sql('SELECT ENAME INTO :my_ename FROM EMP');


Example
/* Suppose you want your report to create a table named CHECK ** just before the Runtime Parameter Form is displayed. ** Because CREATE TABLE is a SQL DDL statement (and PL/SQL ** cannot perform DDL statements), you need to use SRW.DO_SQL. ** Therefore, your PL/SQL could look like this in the Before Form trigger:*/
/* Additional Information: If you use a table created in this way for your** report output, the table must exist before you create your query in the ** data model. Otherwise, Report Builder would not be able to parse your query.*/

FUNCTION CREATETAB RETURN BOOLEAN IS
BEGIN
SRW.DO_SQL('CREATE TABLE CHECK (EMPNO NUMBER NOT NULL
PRIMARY KEY, SAL NUMBER (10,2)) PCTFREE 5
PCTUSED 75');
RETURN(TRUE);
EXCEPTION
WHEN SRW.DO_SQL_FAILURE THEN
SRW.MESSAGE(100, 'ERROR WHILE CREATING CHECK TABLE.');
SRW.MESSAGE(50, 'REPORT WAS STOPPED BEFORE THE RUNTIME
PARAMETER FORM.');
RAISE SRW.PROGRAM_ABORT;
END; 

SRW.CONTEXT_FAILURE

Description This exception stops the report execution and raises the following error message:
REP-1426: Running <construct_name> from incorrect context.

Syntax         SRW.CONTEXT_FAILURE;

Usage Notes Report Builder raises this exception when a Report Builder packaged function or procedure is called in the wrong context (see the chart below).
In this chart, NO means that the function or procedure cannot be called in that context; YES means it can.

Name
Parameter Form
Data Model
Format Trigger
Report Trigger
srw.break
NO
YES
YES
NO
srw.do_sql
YES
YES
YES
YES
srw.geterr_run
YES
YES
YES
YES
srw.get_page_num
NO
NO
YES
NO
srw.message
YES
YES
YES
YES
srw.reference
YES
YES
YES
YES
srw.run_report
YES
YES
YES
YES
srw.set_attr
NO
NO
YES
NO
srw.set_field_char
NO
NO
YES
NO
srw.set_field_date
NO
NO
YES
NO
srw.set_field_num
NO
NO
YES
NO
srw.set_maxrow
NO
YES
YES
YES
srw.user_exit
YES
YES
YES
YES


Example

/* Suppose you want your own error message raised,
** instead of the default error message.
** You could handle this exception in the following way:
*/

EXCEPTION
when SRW.CONTEXT_FAILURE then
srw.message(4000, 'Contact the Application
Development group regarding SRW.CONTEXT_FAILURE.');
raise srw.program_abort;

   31)  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 a pl/sql statement.

32)  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

33)  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.

34) What is Place holder Column?                                                  
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.

35) What is Formula Column? A formula column performs a user-defined computation on another column(s) data, including placeholder columns.

36)  What is a Summary column?              
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.

37)  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.

38) 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 developer. 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
·         Declare: create a named sql area
·         Open: identify the active set.
·         Fetch: load the current row in to variables.
·         Close: release the active set.

CURSOR ATTRIBUTES:
·         %is open: evaluates to true if the cursor is open.
·         %not found: evaluates to true if the most recent fetch does not return a row
·         %found: evaluates to true if the most recent fetch returns a row.
·         %row count: evaluates to the total number of rows returned to far.
         
EXAMPLE:
          Begin
              Open emp_cursor;
             Loop
                  Fetch when emp_cursor % rowcount >10 or
                                                                      Emp_curor % not found;
                 dbms_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;

39) 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;

40) Attribute data types?
                   1) %type 2) %row type.

41) 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
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:
n      You can use this procedure to issue user-defined error messages from stored sub programs.
n      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 =’Oracleapps4u’
                   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;                 
       
42)  Can u define exceptions twice in same block?
No
43)  Can you have two functions with the same name in a pl/sql block?
Yes
44) Can you have two stored functions with in the same name?
Yes 
45) Can function be overload?
Yes
46) What is the maximum number of statements that can be specified in a trigger statement?
One
47)  Can functions be overloaded ?
Yes
48) Can 2 functions have same name & input parameters but differ only by return data type
No
49)  What is a 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.

50)  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 


1 comment:

  1. Thanks and Regards. Oracle Apps R12 Training Videos at affordable cost. please check oracleappstechnical.com for details

    ReplyDelete