Oracle apps PLSQL interview questions - 2



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 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);
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? Check the following blog post for AR base tables: http://oracleapps4u.blogspot.com/2011/07/oracle-apps-account-receivable-tables.html 

9)    What are the interface tables of the customer conversion? Check the following blog post for interface tables in customer conversion: http://oracleapps4u.blogspot.com/2011/07/interfaces-and-conversions-in-oracle.html

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 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
·         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?
                   
Check the following blog post for user exits in oracle reports:
    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?                                                      Check out the following blog post for detailed explanation: http://oracleapps4u.blogspot.com/2011/08/sequence-of-sql-statement-processed.html
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 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 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
         
Check the blog post for more details on SRW Package: http://oracleapps4u.blogspot.com/search/label/SRW%20Package

   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 forward_pack;