SELECT (TO_DATE (:TO_DATE) - (TO_DATE (:from_date)) + 1
)
- (SELECT COUNT (days)
FROM (SELECT ( TO_DATE (TO_CHAR (TO_DATE (:from_date),
'YYYYMMDD'
),
'YYYYMMDD'
)
+ LEVEL
- 1
) days
FROM DUAL
CONNECT BY LEVEL <=
TO_NUMBER (TO_CHAR (TO_DATE (:TO_DATE), 'DD')))
WHERE TO_CHAR (days, 'DY') = 'SUN') AS total_working_days
FROM DUAL
Wednesday, June 29, 2011
Monday, June 20, 2011
PO Requisition Interface
Interface tables: PO_REQUISITIONS_INTERFACE_ALL
Base tables:
PO_REQUISITION_HEADERS_ALL
PO_REQUISITION_LINES_ALL
PO_REQ_DISTRIBUTIONS_ALL
Error Table:
select * from PO_INTERFACE_ERRORS
where Interface_type = 'REQIMPORT'
Concurrent program: REQUISITION IMPORT
Validations:
Check for interface transaction source code, requisition destination type,
quantity ordered, authorization status type.
Some important columns that need to be populated in the interface tables:
PO_REQUISITIONS_INTERFACE_ALL:
INTERFACE_SOURCE_CODE (to identify the source of your imported
Requisitions)
DESTINATION_TYPE_CODE
AUTHORIZATION_STATUS
PREPARER_ID or PREPARER_NAME
QUANTITY
CHARGE_ACCOUNT_ID or charge account segment values
DESTINATION_ORGANIZATION_ID or DESTINATION_ORGANIZATION_CODE
DELIVER_TO_LOCATION_ID or DELIVER_TO_LOCATION_CODE
DELIVER_TO_REQUESTOR_ID or DELIVER_TO_REQUESTOR_NAME
ORG_ID
ITEM_ID or item segment values (values if the SOURCE_TYPE_CODE or
DESTINATION_TYPE_CODE is ‘INVENTORY’)
apps.fnd_request.submit_request
(
application => 'PO',
program => 'REQIMPORT',
description => '',
start_time => TO_CHAR(SYSDATE,'DD-MON-YY HH24:MI:SS'),
sub_request => FALSE,
argument1 => 'INV',--Interface Source code,
argument2 => 1035, ----APPS.SONA_BATCH_ID_S.CURRVAL,--Batch ID,
argument3 => 'ALL',--Group By,
argument4 => '',--Last Req Number,
argument5 => '',--Multi Distributions,
argument6 => 'N'
);
EXAMPLE :
INSERT INTO PO_REQUISITIONS_INTERFACE_ALL(
DELIVER_TO_LOCATION_ID
, DELIVER_TO_REQUESTOR_ID
, AUTHORIZATION_STATUS
, REQUISITION_HEADER_ID
, REQUISITION_TYPE
, CREATION_DATE
, CREATED_BY
, QUANTITY
, UNIT_PRICE
, ITEM_SEGMENT1
, ITEM_DESCRIPTION
, CATEGORY_ID
, CURRENCY_CODE
, PREPARER_ID
, CHARGE_ACCOUNT_ID
, REQ_NUMBER_SEGMENT1
, SOURCE_TYPE_CODE
, HEADER_DESCRIPTION
, BATCH_ID
, DESTINATION_TYPE_CODE
, DESTINATION_ORGANIZATION_ID
, INTERFACE_SOURCE_CODE
, UNIT_OF_MEASURE
,NEED_BY_DATE
,LINE_ATTRIBUTE9
)
VALUES
(
2734 -----> DELIVER_TO_LOCATION_ID
,3336 -----> DELIVER_TO_REQUESTOR_ID
,'INCOMPLETE' -----> AUTHORIZATION_STATUS
,PO_REQUISITION_HEADERS_S.NEXTVAL -----> REQUISITION_HEADER_ID
,'PURCHASE' ----> REQUISITION_TYPE
,SYSDATE ----> CREATION_DATE
,6871 ----> CREATED_BY
,20 ---> QUANTITY
,ln_unit_rate ---> UNIT_PRICE
,ITEM_SEGMENT1 ----->ITEM_SEGMENT1
,ITEM_DESCRIPTION -----> ITEM_DESCRIPTION
,62 ----> CATEGORY_ID
,'INR' -----> CURRENCY_CODE
,3336 -----> PREPARER_ID
,2376 ----> CHARGE_ACCOUNT_ID
,NULL ----> REQ_NUMBER_SEGMENT1
,'VENDOR' ----> SOURCE_TYPE_CODE
,HEADER_DESCRIPTION -----> HEADER_DESCRIPTION
,1035 ---APPS.SONA_BATCH_ID_S.NEXTVAL -----> BATCH_ID
,'INVENTORY' ------> DESTINATION_TYPE_CODE
,DESTINATION_ORGANIZATION_ID -----> DESTINATION_ORGANIZATION_ID
,'INV' ---> INTERFACE_SOURCE_CODE
,ln_unit_measure ----> UNIT_OF_MEASURE
,(sysdate + 10) -----> NEED_BY_DATE
,NULL
);
WIP JOB SCHEDULE INTERFACE
Base table :
1) WIP_DISCRETE_JOBS
2) WIP_LINES
3) WIP_ENTITIES
4) WIP_OPERATIONS
5) WIP_TRANSACTIONS
Concurrent Program to import data :
WIP Mass Load
Interface Table :
WIP_JOB_SCHEDULE_INTERFACE
Error table :-
WIP_INTERFACE_ERRORS
Run The Conncurent for the submison of the discrete jobs into the base table :
apps.fnd_request.submit_request
(application => 'WIP',
program => 'WICMLP', -- CONCURRENT PROGRAM SHORT NAME
description => '',
start_time => TO_CHAR(SYSDATE,'DD-MON-YY HH24:MI:SS'),
sub_request => FALSE,
argument1 => '1041'--Group ID,
);
fnd_file.put_line (fnd_file.LOG,'MESSEGE');
EXAMPLE :
INSERT INTO wip_job_schedule_interface
(created_by
,creation_date
,last_updated_by
,last_update_date
,process_phase
,process_status
,job_name
,load_type
,primary_item_id
,class_code
,status_type
,start_quantity
,first_unit_start_date
,alternate_bom_designator
,bom_revision
,alternate_routing_designator
,routing_revision
,wip_supply_type
,completion_subinventory
,attribute_category
,attribute1
,attribute2
,attribute3
,attribute4
,attribute5
,attribute6
,attribute7
,attribute8
,attribute9
,attribute10
,organization_id
,GROUP_ID
)
VALUES (created_by -----> created_by needs to be changed
,SYSDATE -----> creation_date needs to be changed
, last_updated_by -----> last_updated_by needs to be changed
,SYSDATE ---->last_update_date needs to be changed
,2 -----> process_phase
,1 -----> process_status
,WIP_JOB_NUMBER_S.nextval -----> job_name has to be unique and needs to be changed
,1 ----> load_type
,ln_item_code ----> primary_item_id needs to be changed
,'Standard' ----> class_code
,1 ----> status_type
,start_quantity ----> start_quantity needs to be changed
,SYSDATE ----> first_unit_start_date
,NULL -----> alternate_bom_designator
,NULL -----> bom_revision
,NULL -----> alternate_bom_designator
,NULL -----> routing_revision
,2 ----> wip_supply_type
,'WIP_COMP' ----> completion_subinventory
,NULL -----> attribute_category
,NULL -----> attribute1
,NULL -----> attribute2
,NULL -----> attribute3
,NULL -----> attribute4
,NULL -----> attribute5
,NULL -----> attribute6
,NULL -----> attribute7
,NULL -----> attribute8
,NULL -----> attribute9
,NULL -----> attribute10
,organization_id ----->organization_id needs to be changed
, GROUP_ID -----> GROUP_ID needs to be changed
);
Saturday, June 18, 2011
FND USER EXIT SYNTAX
FND FLEXSQL - This user exits allows you to use Flex fields in Reports
Call this user exit to create a SQL fragment usable by your report to tailor your SELECT
statement that retrieves flexfield values. This fragment allows you to SELECT flexfield
values or to create a WHERE, ORDER BY, GROUP BY, or HAVING clause to limit or
sort the flexfield values returned by your SELECT statement. You call this user exit once
for each fragment you need for your select statement. You define all flexfield columns in
your report as type CHARACTER even though your table may use NUMBER or DATE or
some other datatype.
Syntax:
FND FLEXSQL
CODE=? flexfield code?
APPL_SHORT_NAME=? application short name?
OUTPUT=?: output lexical parameter name?
MODE=?{ SELECT | WHERE | HAVING | ORDER BY}?
[DISPLAY=?{ALL | flexfield qualifier | segment number}?]
[SHOWDEPSEG=?{Y | N}?]
[NUM=?: structure defining lexical? |
MULTINUM=?{Y | N}?]
[TABLEALIAS=? code combination table alias?]
[OPERATOR=?{ = | < | > | <= | >= | != | ?||?|
BETWEEN | QBE}?]
[OPERAND1=?: input parameter or value?]
[OPERAND2=?: input parameter or value?]
e.g-
SRW.USER_EXIT('FND FLEXSQL CODE="MSTK" NUM=":P_STRUCT_NUM" DISPLAY="ALL"
APPL_SHORT_NAME="INV" OUTPUT=":P_ITEM_FLEXDATA" MODE="SELECT" TABLEALIAS="msi"');
FND FLEXIDVAL - This user exits allows you to use Flex fields in Reports
Call this user exit to populate fields for display. You pass the key flexfields data retrieved
by the query into this exit from the formula column. With this exit you display values,
descriptions and prompts by passing appropriate token (any one of VALUE,
DESCRIPTION, APROMPT or LPROMPT).
Syntax:
FND FLEXIDVAL
CODE=? flexfield code?
APPL_SHORT_NAME=? application short name?
DATA=?: source column name?
[NUM=?: structure defining source column/lexical?]
[DISPLAY=?{ALL| flexfield qualifier| segment number}?]
[IDISPLAY=?{ALL| flexfield qualifier| segmentnumber}?]
[SHOWDEPSEG=?{Y | N}?]
[VALUE=?: output column name?]
[DESCRIPTION=?: output column name?]
[APROMPT=?: output column name?]
[LPROMPT=?: output column name?]
[PADDED_VALUE=?: output column name?]
[SECURITY=?: column name?]
Call this user exit to create a SQL fragment usable by your report to tailor your SELECT
statement that retrieves flexfield values. This fragment allows you to SELECT flexfield
values or to create a WHERE, ORDER BY, GROUP BY, or HAVING clause to limit or
sort the flexfield values returned by your SELECT statement. You call this user exit once
for each fragment you need for your select statement. You define all flexfield columns in
your report as type CHARACTER even though your table may use NUMBER or DATE or
some other datatype.
Syntax:
FND FLEXSQL
CODE=? flexfield code?
APPL_SHORT_NAME=? application short name?
OUTPUT=?: output lexical parameter name?
MODE=?{ SELECT | WHERE | HAVING | ORDER BY}?
[DISPLAY=?{ALL | flexfield qualifier | segment number}?]
[SHOWDEPSEG=?{Y | N}?]
[NUM=?: structure defining lexical? |
MULTINUM=?{Y | N}?]
[TABLEALIAS=? code combination table alias?]
[OPERATOR=?{ = | < | > | <= | >= | != | ?||?|
BETWEEN | QBE}?]
[OPERAND1=?: input parameter or value?]
[OPERAND2=?: input parameter or value?]
e.g-
SRW.USER_EXIT('FND FLEXSQL CODE="MSTK" NUM=":P_STRUCT_NUM" DISPLAY="ALL"
APPL_SHORT_NAME="INV" OUTPUT=":P_ITEM_FLEXDATA" MODE="SELECT" TABLEALIAS="msi"');
FND FLEXIDVAL - This user exits allows you to use Flex fields in Reports
Call this user exit to populate fields for display. You pass the key flexfields data retrieved
by the query into this exit from the formula column. With this exit you display values,
descriptions and prompts by passing appropriate token (any one of VALUE,
DESCRIPTION, APROMPT or LPROMPT).
Syntax:
FND FLEXIDVAL
CODE=? flexfield code?
APPL_SHORT_NAME=? application short name?
DATA=?: source column name?
[NUM=?: structure defining source column/lexical?]
[DISPLAY=?{ALL| flexfield qualifier| segment number}?]
[IDISPLAY=?{ALL| flexfield qualifier| segmentnumber}?]
[SHOWDEPSEG=?{Y | N}?]
[VALUE=?: output column name?]
[DESCRIPTION=?: output column name?]
[APROMPT=?: output column name?]
[LPROMPT=?: output column name?]
[PADDED_VALUE=?: output column name?]
[SECURITY=?: column name?]
These two user exits are used for the Key Flex field reporting. Where you have to capture and print the date which stored in the segments of the table.
FND FLEXSQL is used to capture the data from segments.
FND FLEXIDVAL is used to populate the captured segment values.
If you want to use these user exits then we have follow below steps :
1. Create 3 Variables
Name DataType Initial value
P_CONC_REQUEST_ID Number(20) --
P_Struct_Num Number(20) --
P_Flex_Data Char(6000) (Segment1||' '||Segment2......||Segmentn)
2. In Before Report Trigger
SRW.Reference(:P_Struct_Num);
SRW.User_Exit('FND SRWINIT');
SRW.User_Exit('FND FLEXSQL
CODE="GL#"
NUM=":P_Struct_Num"
Appl_short_Name="SQLGL"
Output=":P_Flex_Data"
Mode = "Select"
Display ="All"');
compile and close.
3. In After Report Trigger
SRW.USER_EXIT('FND SRWEXIT');
compile and close.
4. Go to Data Model in Report Builder
selet Last_update_date,&P_Flex_Data C_Flexdata from gl_code_combinations
where chart_of_accounts_id=:P_ Struct_Num
5. got to Data model create layout using wizard.
6. Create a formula column with CF_Data datatype char(6000)
In that formula column
SRW.REFERENCE(:P_Struct_Num);
SRW.REFERENCE(:C_Flexdata);
SRW.USER_EXIT('FND FLEXIDVAL
CODE="GL#"
NUM=":P_Struct_Num"
Appl_short_Name="SQLGL"
Date=":C_Flexdata"
Value = ":CF_Data"
Mode = "Select"
Display ="All"');
return (:CF_Data);
compile and close.
7. Register the report in the applications and run it.
FND FLEXSQL is used to capture the data from segments.
FND FLEXIDVAL is used to populate the captured segment values.
If you want to use these user exits then we have follow below steps :
1. Create 3 Variables
Name DataType Initial value
P_CONC_REQUEST_ID Number(20) --
P_Struct_Num Number(20) --
P_Flex_Data Char(6000) (Segment1||' '||Segment2......||Segmentn)
2. In Before Report Trigger
SRW.Reference(:P_Struct_Num);
SRW.User_Exit('FND SRWINIT');
SRW.User_Exit('FND FLEXSQL
CODE="GL#"
NUM=":P_Struct_Num"
Appl_short_Name="SQLGL"
Output=":P_Flex_Data"
Mode = "Select"
Display ="All"');
compile and close.
3. In After Report Trigger
SRW.USER_EXIT('FND SRWEXIT');
compile and close.
4. Go to Data Model in Report Builder
selet Last_update_date,&P_Flex_Data C_Flexdata from gl_code_combinations
where chart_of_accounts_id=:P_
5. got to Data model create layout using wizard.
6. Create a formula column with CF_Data datatype char(6000)
In that formula column
SRW.REFERENCE(:P_Struct_Num);
SRW.REFERENCE(:C_Flexdata);
SRW.USER_EXIT('FND FLEXIDVAL
CODE="GL#"
NUM=":P_Struct_Num"
Appl_short_Name="SQLGL"
Date=":C_Flexdata"
Value = ":CF_Data"
Mode = "Select"
Display ="All"');
return (:CF_Data);
compile and close.
7. Register the report in the applications and run it.
Deleting a concurrent program from back end and compile form
DECLARE
v_program_short_name VARCHAR2 (200);
v_program_application VARCHAR2 (200);
v_request_group1 VARCHAR2 (200);
v_group_application VARCHAR2 (200);
BEGIN
v_program_short_name := 'X1_APXPBFTR_WS';
v_program_application := 'SQLAP';
v_request_group1 := 'All Reports';
v_group_application := 'SQLAP';
--+=======================================================================
--+Remove Concurrent Program From Request Group
--+=======================================================================
apps.fnd_program.remove_from_group
(program_short_name => v_program_short_name,
program_application => v_program_application,
request_group => v_request_group1,
group_application => v_group_application
);
COMMIT;
--+=======================================================================
--+Remove Concurrent Program Definition and Executable
--+=======================================================================
apps.fnd_program.delete_program(v_program_short_name,v_program_application);
apps.fnd_program.delete_executable(v_program_short_name,v_program_application);
DELETE FROM APPS.XDO_LOBS WHERE LOB_CODE = v_program_short_name;
APPS.XDO_TEMPLATES_PKG.DELETE_ROW(v_program_application, v_program_short_name);
DELETE FROM APPS.XDO_DS_DEFINITIONS_TL WHERE DATA_SOURCE_CODE = v_program_short_name;
DELETE FROM APPS.XDO_DS_DEFINITIONS_B WHERE DATA_SOURCE_CODE = v_program_short_name;
COMMIT;
END;
/
EXIT
/
Deleting a concurrent Program
Begin
fnd_program.delete_program(' program short name','APPLICATION_SHORT_NAME');
fnd_program.delete_executable( 'program short name','APPLICATION_SHORT_NAME');
commit;
End;
Deleting a xml template
BEGIN
XDO_TEMPLATES_PKG.DELETE_ROW(APPLICATION_SHORT_NAME ,TEMPLATE_CODE);
COMMIT;
END;
COMPILE THE FORM IN ORACLE R12
frmcmp_batch module=XX_GATE_ENTRY.fmb userid=apps/fserver output_file=/oracle2/VIS1211/apps/apps_st/appl/po/12.0.0/forms/US/XX_GATE_ENTRY.fmx compile_all=YES
COMPILE THE FORM IN ORACLE 11i
f60gen module=XX_GATE_ENTRY.fmb userid=apps/fserver output_file=/oracle2/VIS1211/apps/apps_st/appl/po/12.0.0/forms/US/XX_GATE_ENTRY.fmx compile_all=YES
v_program_short_name VARCHAR2 (200);
v_program_application VARCHAR2 (200);
v_request_group1 VARCHAR2 (200);
v_group_application VARCHAR2 (200);
BEGIN
v_program_short_name := 'X1_APXPBFTR_WS';
v_program_application := 'SQLAP';
v_request_group1 := 'All Reports';
v_group_application := 'SQLAP';
--+=======================================================================
--+Remove Concurrent Program From Request Group
--+=======================================================================
apps.fnd_program.remove_from_group
(program_short_name => v_program_short_name,
program_application => v_program_application,
request_group => v_request_group1,
group_application => v_group_application
);
COMMIT;
--+=======================================================================
--+Remove Concurrent Program Definition and Executable
--+=======================================================================
apps.fnd_program.delete_program(v_program_short_name,v_program_application);
apps.fnd_program.delete_executable(v_program_short_name,v_program_application);
DELETE FROM APPS.XDO_LOBS WHERE LOB_CODE = v_program_short_name;
APPS.XDO_TEMPLATES_PKG.DELETE_ROW(v_program_application, v_program_short_name);
DELETE FROM APPS.XDO_DS_DEFINITIONS_TL WHERE DATA_SOURCE_CODE = v_program_short_name;
DELETE FROM APPS.XDO_DS_DEFINITIONS_B WHERE DATA_SOURCE_CODE = v_program_short_name;
COMMIT;
END;
/
EXIT
/
Deleting a concurrent Program
Begin
fnd_program.delete_program('
fnd_program.delete_executable(
commit;
End;
Deleting a xml template
BEGIN
XDO_TEMPLATES_PKG.DELETE_ROW(APPLICATION_SHORT_NAME ,TEMPLATE_CODE);
COMMIT;
END;
COMPILE THE FORM IN ORACLE R12
frmcmp_batch module=XX_GATE_ENTRY.fmb userid=apps/fserver output_file=/oracle2/VIS1211/apps/apps_st/appl/po/12.0.0/forms/US/XX_GATE_ENTRY.fmx compile_all=YES
COMPILE THE FORM IN ORACLE 11i
f60gen module=XX_GATE_ENTRY.fmb userid=apps/fserver output_file=/oracle2/VIS1211/apps/apps_st/appl/po/12.0.0/forms/US/XX_GATE_ENTRY.fmx compile_all=YES
To Find in which "Request group " the Particular Concurrent is Registered
SELECT EXECUTABLE_NAME
,EXECUTION_FILE_NAME
,APPLICATION_SHORT_NAME
, fcpl.user_concurrent_program_ name
, fcp.concurrent_program_name
, par.end_user_column_name
, par.form_left_prompt prompt
, par.enabled_flag
, par.required_flag
, par.display_flag
FROM fnd_concurrent_programs fcp
, fnd_concurrent_programs_tl fcpl
, fnd_descr_flex_col_usage_vl par
, FND_EXECUTABLES fe
,fnd_application fa
WHERE fcp.concurrent_program_id = fcpl.concurrent_program_id
AND fcpl.user_concurrent_program_ name ='India - Debtors Trial Balance Report'
AND fcpl.LANGUAGE = 'US'
AND par.descriptive_flexfield_name = '$SRS$.' || fcp.concurrent_program_name
and fe.application_id=fa. application_id
and fe.EXECUTABLE_ID = fcp.executable_id
,EXECUTION_FILE_NAME
,APPLICATION_SHORT_NAME
, fcpl.user_concurrent_program_
, fcp.concurrent_program_name
, par.end_user_column_name
, par.form_left_prompt prompt
, par.enabled_flag
, par.required_flag
, par.display_flag
FROM fnd_concurrent_programs fcp
, fnd_concurrent_programs_tl fcpl
, fnd_descr_flex_col_usage_vl par
, FND_EXECUTABLES fe
,fnd_application fa
WHERE fcp.concurrent_program_id = fcpl.concurrent_program_id
AND fcpl.user_concurrent_program_
AND fcpl.LANGUAGE = 'US'
AND par.descriptive_flexfield_name = '$SRS$.' || fcp.concurrent_program_name
and fe.application_id=fa.
and fe.EXECUTABLE_ID = fcp.executable_id
Tuesday, June 14, 2011
FUNCTION TO REMOVE SPECIFIC CHARACTER FOR A STRING AND MULTIPLY THE NUMBERS
create or replace function bom_multi_drill_down (v_input_temp varchar2 ) return number is
v_input varchar2(200);
v_output number;
v_dummy number;
v_loop VARCHAR2 (100);
BEGIN
v_input := v_input_temp;
v_output := 1;
WHILE TRUE
LOOP
v_dummy := to_number(SUBSTR (v_input, 1, INSTR (v_input, ',') - 1));
IF v_dummy IS NULL
THEN
v_output := v_output ;
ELSE
v_output := (v_output * v_dummy) ;
END IF;
v_input := SUBSTR (v_input, INSTR (v_input, ',') + 1);
IF INSTR (v_input, ',') = 0
THEN
IF v_input IS NULL
THEN
v_output := v_output ;
ELSE
v_output := (v_output * v_input);
END IF;
v_input := NULL;
END IF;
IF v_input IS NULL
THEN
EXIT;
END IF;
END LOOP;
DBMS_OUTPUT.put_line ('OUTPUT : ' || v_output);
return(v_output);
END bom_multi_drill_down ;
v_input varchar2(200);
v_output number;
v_dummy number;
v_loop VARCHAR2 (100);
BEGIN
v_input := v_input_temp;
v_output := 1;
WHILE TRUE
LOOP
v_dummy := to_number(SUBSTR (v_input, 1, INSTR (v_input, ',') - 1));
IF v_dummy IS NULL
THEN
v_output := v_output ;
ELSE
v_output := (v_output * v_dummy) ;
END IF;
v_input := SUBSTR (v_input, INSTR (v_input, ',') + 1);
IF INSTR (v_input, ',') = 0
THEN
IF v_input IS NULL
THEN
v_output := v_output ;
ELSE
v_output := (v_output * v_input);
END IF;
v_input := NULL;
END IF;
IF v_input IS NULL
THEN
EXIT;
END IF;
END LOOP;
DBMS_OUTPUT.put_line ('OUTPUT : ' || v_output);
return(v_output);
END bom_multi_drill_down ;
INTERVIEW QUESTIONS AND ANSWERS
1. What is NOCOPY?
By default the IN parameter is passed by reference and the OUT and IN OUT parameters are passed by value.
NOCOPY is a compiler hint that can be used with OUT and IN OUT parameter to request to pass by reference. This improves the performance with OUT and INOUT parameters.
2. REPORT TYPES:
A) Tabular Report
B) Group Left Report
C) Group Above Report
D) Form like report
E) Matrix Report
F) Matrix with group
G) Mailing Label Report
H) Form Letter
3. Anchors: are used to determine the vertical and horizontal positioning of a child object relative to its parent object. The end of the anchor should be attached to the parent object. An Anchor can relate two child objects to one parent object.
Anchor Properties:
A) Child Edge percent on child edge type
B) Child Object Name
C) Collapse Horizontally ---- If the parent object does not print, the child object moves horizontally into the space vacated by the parent.
D) Collapse vertically
E) Comments
F) Name
4. User Exits:
Program that can be written and linked into the report builder executable or user exit DLL files.
User exits are build when ever the control need to be passed from the report builder to a program, which performs some function and then control returns to the Report Builder.
Example:
Function BeforeReport return boolean is
Begin
SRW.USER_EXIT('FND SRWINIT');
:CP_1:=FND_GLOBAL.USER_ID;
:CP_2:=FND_GLOBAL.USER_NAME;
Return (TRUE);
End;
Function AfterReport return boolean is
Begin
SRW.USER_EXIT('FND SRWEXIT');
return (TRUE);
End;
Function AfterReport 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;
Types of user exits :-
A) Oracle Pre-Complier user exits.
B) OCI (Oracle Call Interface user exits)
C) Non – Oracle user exits.
User exits can perform the following tasks.
Perform complex data manipulation.
Pass data to report builder from OS text files.
Support PL/SQL blocks.
Control real time devices be printer or robot.
5.Report Triggers: -
Before Parameter form Trigger
- Fires before the runtime parameter form is displayed.
- The parameter values can be accessed and changed.
After Parameter form Trigger.
- Fires after the runtime parameter form is displayed.
- The parameters can be accessed and their values can be checked.
Before Report Trigger
- Fires before the reports is executed but after the queries are passed and data is fetched.
Between Pages Trigger.
- Fires between each page of the report are formatted, except the very first pages.
- This is used for customized page formatting.
After Report Trigger
- Fires after exiting from the run time premier or after report output is sent to a specified destination. (File, Printer, Mail id etc….)
- This is used to clean up any initial processing that was done such as deleting the tables.
- This Trigger always fires irrespective of success or failure of the report.
DATA TRIGGERS:
REF CURSORS QUERY:
This uses PL/SQL to fetch data for the report.
- In this a PL/SQL function need to be specified to return a cursor value from a cursor variable.
Weak REF CURSORS vs. Strong REF CURSORS
---------------------------------------
When a cursor subquery appears in the select list of some SQL statement, the
Corresponding column must be fetched into a PL/SQL REF CURSOR variable. Only
Weak REF CURSOR variables are currently supported. For example,
-- A cursor subquery column CAN be fetched into myweakcur
TYPE weak_ref_cursor is REF CURSOR;
myweakcur weak_ref_cursor;
-- A cursor subquery column CANNOT be fetched into mystrongcur
TYPE strong_ref_cursor is REF CURSOR RETURN emp%ROWTYPE;
mystrongcur strong_ref_cursor;
The primary benefit of strong REF CURSORS is to permit certain checks to be
Performed during compilation, preventing runtime errors that would occur if the rows returned don't match the variables into which they are fetched. So It is possible for a program using cursor subqueries to compile cleanly and fail at runtime if care is not taken to ensure that the cursor subquery and any fetches against the resulting REF CURSOR match.
Example:
DECLARE
TYPE REFCUR IS REF CURSOR;
A REFCUR;
B REFCUR;
VEMP EMP%ROWTYPE;
VDEPT DEPT%ROWTYPE;
BEGIN
OPEN A FOR SELECT * FROM DEPT;
LOOP
FETCH A INTO VDEPT;
EXIT WHEN A%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(VDEPT.DEPTNO||' '||VDEPT.DNAME);
OPEN B FOR SELECT * FROM EMP WHERE DEPTNO=VDEPT.DEPTNO;
LOOP
FETCH B INTO VEM
P;
EXIT WHEN B%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(VEMP.EMPNO||' '||VEMP.ENAME);
END LOOP;
CLOSE B;
END LOOP;
CLOSE A;
END;
Group Filter:
This is PL/SQL function that determines which records to be included in a group in the property are PL/SQL.
- The function must return a BOOLEAN value.
True ……. Includes the current record in the report.
False ……. Excludes the current record from the report.
A group filter determines which records to include in a group. You can use the packaged filters, first and last, to display the first n or last n records for the group, or you can create your own filters using PL/SQL.
Example:
function filter_comm return boolean is
begin
if :comm IS NOT NULL then
if :comm < 100 then
return (FALSE);
else
return (TRUE);
end if;
else
return (FALSE); -- for rows with NULL commissions
end if;
end;
Formula
- These are PL/SQL functions that populate formula or place holder columns.
Validation Trigger
- These are also PL/SQL functions that are executed when parameter values are specified on the command line and when the runtime parameter form is accepted.
- Are also used to validate the initial value property of the parameter.
Layout Triggers
Format Trigger.
- These are PL/SQL functions executed before the object is formatted.
- Used to dynamically change the formatting attributes of the object.
Action Trigger
- These are PL/SQL procedures executed when a button is selected in the run time
Pre-viewer.
- This can be used to dynamically call another report or execute any other PL/SQL.
Example:
procedure U_1ButtonAction is
begin
SRW.RUN_REPORT('report=C:\TEMP\EMP.RDF');
-- srw.run_report('batch=yes report=C:\TEMP\EMP.RDF');
EXCEPTION
when srw.run_report_failure then
srw.message(30, 'Error mailing reports.');
raise srw.program_abort;
end;
6 Formula Column
It performs a user-defined computation on another columns data, including Place-
holder columns.
Formulas are PL/SQL functions that populate formula or place holder columns.
Cannot be used to populate parameter values.
7 Summary Column
Performs a computation on another columns data like sum, average, count, minimum, maximum, %, total.
For group reports, the report wizard and data wizard create ‘n’ summary fields in the data model for each summary column that is defined.
One at each group level above the column being summarized.
One at the report level.
8 Place Holder Column
- A Place holder column is a column for which, the data type and value can be set dynamically (Programmatically)
The value can be set for a placeholder column in the following places.
- Before report trigger if the placeholder is a report level column.
- Report level formula column, if the placeholder is a report level column.
- A formula in the place holders group below it (The value is set once for each record of the group)
9 Repeating Frame
- Repeating frame surrounds all of the fields that are created for group’s columns.
- Repeating frame prints once for each record of the group.
- For frames and repeating frames, the property elasticity defines whether the size of the frame or repeating frame should with the objects inside of it at runtime.
10 Frame
- Surrounds the objects and protect them from being over written or pushed by other objects.
11.System Parameters:
BACKGROUND Is whether the report should run in the foreground or the background.
COPIES Is the number of report copies that should be made when the report is printed.
CURRENCY Is the symbol for the currency indicator (e.g., "$").
DECIMAL Is the symbol for the decimal indicator (e.g., ".").
DESFORMAT Is the definition of the output device's format (e.g., landscape mode for a printer). This parameter is used when running a report in a character-mode environment, and when sending a bitmap report to a file (e.g. to create PDF or HTML output).
DESNAME Is the name of the output device (e.g., the file name, printer's name, mail userid).
DESTYPE Is the type of device to which to send the report output (screen, file, mail, printer, or screen using PostScript format).
MODE Is whether the report should run in character mode or bitmap.
ORIENTATION Is the print direction for the report (landscape, portrait, default).
PRINTJOB Is whether the Print Job dialog box should appear before the report is run.
THOUSANDS Is the symbol for the thousand's indicator (e.g., ",").
12 Data Link
- Data links relate the results of multiple queries.
- A data link (Parent – Child Relation Ship) causes the child query to be executed once for each instance of its parent group.
Three types of data links are
- Query to query
- Column to column
- Group to group
13 In which tables FF are stored?
A) FND – ID – FLEXS
B) FND-ID-FLEX-STRUCTURES
A flexfield is a field made up of sub–fields, or segments. A flexfield
appears on your form as a pop–up window that contains a prompt for
each segment. Each segment has a name and a set of valid values.
There are two types of flexfields: key flexfields and descriptive
flexfields.
14 Advantages of stored functions and procedures
* Applications can be modularized.
* Easy maintenance.
Routines can be modified online without interfering other users.
One routine can be modified to effect multiple applications.
* Improved data security and integrity.
- Indirect access to database objects can be controlled from non-privileged users with security privileges.
* Improved performance.
- Reparsing for multiple users can be avoided by exploiting the shared SQL area.
- PL/SQL parsing at run-time can be avoided by pursing at compile time.
- Number of calls to the database can be reduced and network traffic decreased by bundling commands.
* Improved code clarity.
- The clarity of code increases by using appropriate identifier names to describe the
action of the routines that reduces the need for comments.
15 Difference between a function and a procedure
Functions Procedures
* Invoke as a part of an expression. Execute as a PL/SQL statement.
* Must contain a RETURN clause Do not contain a RETURN
in the header. Clause in the header.
* Must return a single value. Can return none, one or many
values.
* Must contain at fast one RETURN Can contain a RETURN
Statement. Statement.
* Do not contain OUT and INOUT Can contain IN, Out and
IN OUT parameters. IN OUT Parameters.
16 About Cursors
- Oracle server uses some private work areas to execute SQL statements and to store processing information.
- By using PL/SQL cursors these private SQL areas can be named and the stored Information can be accessed.
Two Types:
* Implicit Cursors.
- Implicit cursors are declared by PL/SQL implicitly for all DML and PL/SQL select statements, including queries that return only one row.
- Oracle Server implicitly opens a cursor to process each SQL statement not associated with on explicitly declared cursor.
- The most recent implicit cursor can be returned as the SQL cursor.
* Explicit Cursors
- For queries that return more than one row, explicit cursors are declared and named by the programs and manipulated through specific statements in the block’s executable actions.
- Explicit cursors are used to individually process each row returned by a multiple-row SELECT statement.
- The set of rows returned by a multiple – row query is called as active set.
Cursor Attributes: -
Attribute Type Description
% is open -- Boolean Evaluates to TRUE if the cursor is open.
% not found -- Boolean Evaluates to TRUE if the most recent fetch
doesn’t return a row.
% found -- Boolean Evaluate to TRUE if the most recent fetch
returns a row. Complement of % not found.
% Row Count -- Number Evaluates the total number of rows returned
so far.
Parameterized Cursors: -
- Parameters can be passed to the cursor in a cursor for loop.
- It allow to open and close an explicit cursor several times in a block, returning a different active set on each occasion for each execution, the previous cursor is closed and reopened with a new set of parameters.
- Sizes should not be mentioned for the data types of parameters the parameters names are for references in the query expression of the cursor.
Example:
DECLARE
CURSOR c1(test NUMBER,test1 VARCHAR2) IS SELECT * FROM emp WHERE empno=test AND ename=test1;
R1 C1%ROWTYPE;
BEGIN
OPEN c1(7369,'SASHI');
FETCH C1 INTO R1;
DBMS_OUTPUT.PUT_LINE(R1.JOB);
END;
17 Confined Modes: -
- If it is on, child objects cannot be moved outside their enclosing parent objects.
- If it is off child objects can be moved out sides their enclosing parent objects.
Flex Mode: -
- If it is on, parent borders stretch when child objects are moved against them.
- If it is off, parent borders remain fixed when child objects are moved against them.
18 Parameters
- A parameter is a variable whose value can be set at runtime (from the run time parameter of the command line).
- User parameters are created by the user and system parameters are created by Report Builder.
- System parameters cannot be renamed or deleted.
Bind Parameters (Variables)
- Bind references (or Variables) are used to replace a single value in SQL or PL/SQL, such as a character string, number or date.
- 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 cannot be referenced in FROM clauses.
- Bind variables can be referenced by entering a colon (:) followed immediately by the column or parameter name.
- If the parameter / column is not created before making a bind reference, report builder will create a parameter.
Lexical Parameters (Variables)
- Lexical references are placeholders for text that is embedded in a SELECT statement.
- Lexical Variables can replace the clauses appearing after SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, CONNECT BY, and START WITH.
What is % Row type?
- % Row types is used to declare a record based on a collection of columns in a database table or view.
- The fields in the record take their names and data types from the columns of the table or view.
- The record can also store an entire row of data fetched from a cursor or cursor variable.
- % Row type should be prefixed with the database table.
Ex: Declare
Emp_record employee 5% row type.
Then emp_record will have a structure consisting of all the fields each representing a column in the employee’s table.
What is a Ref Cursor?
- Oracle server uses unnamed memory spaces to store data used in implicit cursors.
- Ref cursors are used to define a cursor variable, which will point to that memory space and can be used like pointers in SQL ‘S’.
About Exceptions
- An exception is an identifier in PL/SQL that is raised during the execution of a black that terminates its main body of actions.
- A block always terminates when PL/SQL raises an exception so that an exception handler should be specified to perform final actions.
* Exception can be raised in two ways exception is raised automatically.
1. Ex: - when no rows are retrieved from the database in a SELECT statement, then error
ORA-01403 occurs and the exception NO-DATA-FOUND is raised by PL/SQL.
2. Ex: - Exception can be raised explicitly by issuing the RAISE statement with in the
Block.
- The exception being raised may be either.
User-Defined or Pre Defined
Trapping an exception: -
- If the exception is raised in executable section of the block, processing branches to the corresponding exception handler in the exception section of the block.
- If PL/SQL successfully handles the exception, then the exception doesn’t propagate to the enclosing block or calling environment.
- The PL/SQL block terminates successfully.
Propagating an exception: -
- If the exception is raised in the executable section of the block and there is no corresponding exception handler, the PL/SQL block terminates with failure and the exception will be propagated to the calling environment.
Types of exceptions: -
A) Pre-Defined Oracle Server Exceptions. -Implicitly Raised.
B) Non-Pre defined Oracle server exceptions. -Implicitly Raised.
C) User-defined exceptions -Explicitly Raised.
Pre-Defined Oracle Server Exceptions: -
- These are the error (20) that occurs most often in PL/SQL code.
- These exceptions need not be declared and raised implicitly by Oracle Server, NO-DATA-FOUND, LOGIN_DENIED, and ZERO_DIVIDE.
BEGIN
. . .
EXCEPTION
WHEN NO_DATA_FOUND THEN
statement1;
statement2;
WHEN TOO_MANY_ROWS THEN
statement1;
WHEN OTHERS THEN
statement1;
statement2;
statement3;
END;
Non-Pre-Defined Oracle Server Exceptions: -
- These are the other standard Oracle Server errors.
- These exceptions need to be declared in the declarative section and raised by Oracle server implicitly.
DEFINE p_deptno = 10
DECLARE
e_emps_remaining EXCEPTION;
PRAGMA EXCEPTION_INIT
(e_emps_remaining, -2292);
BEGIN
DELETE FROM departments
WHERE department_id = &p_deptno;
COMMIT;
EXCEPTION
WHEN e_emps_remaining THEN
DBMS_OUTPUT.PUT_LINE (’Cannot remove dept ’ ||
TO_CHAR(&p_deptno) || ’. Employees exist. ’);
END;
User Defined Exceptions: -
- These are the conditions that the developer determines as abnormal.
- These need to be declared and raised explicitly.
DECLARE
e_invalid_department EXCEPTION;
BEGIN
UPDATE departments
SET department_name = ’&p_department_desc’
WHERE department_id = &p_department_number;
IF SQL%NOTFOUND THEN
RAISE e_invalid_department;
END IF;
COMMIT;
EXCEPTION
WHEN THEN e_invalid_department THEN
DBMS_OUTPUT.PUT_LINE(’No such department id.’);
END;
PRAGMA EXCEPTION_INIT
Statement is used to associate a declared exception with the standard Oracle Server error number.
Syntax: - PRAGMA EXCEPTION_INIT (exception, error number)
* SQLCODE, SQL ERRM are two functions that can be used to identify the associated error code or error message when exception occurs.
- SQLCODE function returns the numeric value for the error code.
- SQLERRM function returns the character data containing the message associated with the error number.
- SQLCODE f SQLERRM cannot be used directly in SQL statements.
RAISE_APPLICATION_ERROR
Executable section:
BEGIN
...
DELETE FROM employees
WHERE manager_id = v_mgr;
IF SQL%NOTFOUND THEN
RAISE_APPLICATION_ERROR(-20202,
’This is not a valid manager’);
END IF;
...
Exception section:
...
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR (-20201,
’Manager is not a valid employee.’);
END;
What is Dynamic SQL?
- Dynamic SQL is a SQL statement that contains variables that can change during runtime.
- It is a SQL statement with place holders and is stored as a character string.
- Dynamic SQL enables DDL, DCL or session control statements to be written and executed (by) from PL/SQL.
* Dynamic SQL can be written in two ways.
A) DBMS_SQL. -8i
B) Native Dynamic SQL. -8i
- Basically Dynamic SQL means creating the SQL statements dynamically at runtime by using variables.
Ex: - Dynamic SQL can be used to create a procedure that operates on a table whose name is not known until runtime or to execute DDL/DCL/SCS statements.
In PL/SQL such statements cannot be executed statically.
EXECUTE IMMEDIATE Statement can perform dynamic single row queries.
CREATE OR REPLACE PROCEDURE delete_all_rows
(p_tab_name IN VARCHAR2, p_rows_del OUT NUMBER)
IS
cursor_name INTEGER;
BEGIN
cursor_name := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(cursor_name, ’DELETE FROM ’||p_tab_name,
DBMS_SQL.NATIVE );
p_rows_del := DBMS_SQL.EXECUTE (cursor_name);
DBMS_SQL.CLOSE_CURSOR(cursor_name);
END;
/
Using the EXECUTE IMMEDIATE statement
EXECUTE IMMEDIATE dynamic_string
[INTO {define_variable
[, define_variable] ... | record}]
[USING [IN|OUT|IN OUT] bind_argument
[, [IN|OUT|IN OUT] bind_argument] ... ];
INTO is used for single-row queries and specifies
the variables or records into which column values
are retrieved.
USING is used to hold all bind arguments. The
default parameter mode is IN.
CREATE PROCEDURE del_rows
(p_table_name IN VARCHAR2,
p_rows_deld OUT NUMBER)
IS
BEGIN
EXECUTE IMMEDIATE ’delete from ’||p_table_name;
p_rows_deld := SQL%ROWCOUNT;
END;
What are Autonomous Transactions?
- Autonomous transactions are the processes run independently of its parent.
- By means of Autonomous Transaction, the current transaction can be temporarily suspended and another operation can be begun.
- The basic idea behind this is to have some operation take place independently of the current transaction.
Ex: - to allow error messages written to table to be committed but to rollback everything
else that has taken place prior to the error.
- The autonomous or child transaction can commit or rollback as applicable with the execution of the parent transaction being resumed upon its completion.
- The parent may then perform further operations of any operations performed with in the child transaction.
- By using Autonomous Transactions, modular and reusable components can be developed more easily.
- In fact Oracle already uses similar functionality internally, known as recu transactions to handle the updating of system resources.
Ex: - When one application selects ‘nextval’ from a non eached sequence, the value is in
the database.
- Thus a second application will always get the incremented application has committed or rolled back.
- Autonomous Transaction should be defined in PL/SQL in the following manner.
PRAGMA AUTONOMOUS_TRANSACTION;
- Autonomous transaction also can be nested.
- The parent transaction remains active while any statements specified in the declare section of the autonomous unit are executed.
- As the code unit exits and control returns to the parent the main (parent) transaction is resumed and the transaction context is switched back to the parent.
Example:
Create or replace trigger emp_trig
After insert on emp
Declare
Pragma autonomous_transaction;
Begin
Insert into log values(‘The user has inserted’);
Commit;
End;
What is Bulk binding of Bulk collect?
Bulk bind: -
- The assignment of values to PL/SQL variables in SQL statements is called binding.
- The binding of an entire collection at once is refilled to as bulk binding.
- Bulk bind improves performance by minimizing the number of context switches between PL/SQL and SQL engines while they pass an entire collection of elements (varray, nested tables, index-by table or host array) as bind variables back and forth.
- Prior to Oracle 8i, the execution of every SQL statements required a switch between the PL/SQL and SQL engines, where as bulk binds use only one context switch.
Bulk binding includes the following
A) Input collections; use the FORALL statement.
B) Output collections, use the BULK COLLECT clause.
Input Collections: -
- Input collections are data passed from PL/SQL engine to the SQL engine to execute INSERT, UPDATE and DELETE statements.
Syntax: - FORALL index in lower bound.. Upper bound sql_statement;
Output Collections: -
- Output collections are the data passed from the SQL engine to the PL/SQL engine as a result of SELECT or FETCH statements.
- The keyword BULK COLLECT can be used with SELECT INTO, FETCH INTO and RETURNING INTO clauses.
Syntax:- BULK COLLECT into collection name, ……
Example: select * bulk collect into variable_record from emp;
DECLARE
CURSOR c_orders IS
SELECT order_id, currency_code, amount_local /* bulk bind */
FROM open_orders;
TYPE t_num_array IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
TYPE t_char_array IS TABLE OF VARCHAR2(10) INDEX BY BINARY_INTEGER;
v_order_ids t_num_array;
v_currency_codes t_char_array;
v_amounts_local t_num_array;
v_amounts_usd t_num_array;
v_row_count NUMBER := 0;
BEGIN
OPEN c_orders;
LOOP
FETCH c_orders
BULK COLLECT INTO v_order_ids, v_currency_codes, v_amounts_local
LIMIT 100;
EXIT WHEN v_row_count = c_orders%ROWCOUNT;
v_row_count := c_orders%ROWCOUNT;
FOR i IN 1..v_order_ids.count LOOP
v_amounts_usd(i) := currency_convert (v_amounts_local(i),
v_currency_codes(i));
END LOOP;
FORALL i IN 1..v_order_ids.count
UPDATE open_orders /* bulk bind */
SET amount_usd = v_amounts_usd(i)
WHERE order_id = v_order_ids(i);
END LOOP;
CLOSE c_orders;
COMMIT;
END;
DECLARE
TYPE test IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
test1 test;
indx INTEGER;
BEGIN
FOR i IN 1..10 LOOP
test1(i):=10;
NULL;
END LOOP;
FORALL INDX IN VALUES OF test1
INSERT INTO emp(empno) VALUES test1(INDX);
END;
What are Materialized Views and Snapshots?
Materialized View: -
- A Materialized view is a replica of a target master from a single point in time.
- In Oracle 7, it is termed as SNAPSHOT
- Oracle 7.1.6 --Uptable Snapshots
- Oracle 7.3 -Primary Key Snapshots
- Oracle 8 -Materialized view
- Oracle 9 -Multifier Materialized View.
- Materialized views can be used both for creating summaries to be utilized in data warehouse environments.
* Replicating data in distributed environments.
Target Master -The table(s) which is (are) referenced by the MVIEW query.
Base Table -The tables are that is (are) created by MVIEW create statement and that stores data that satisfy the MVIEW query.
Syntax: - Create materialized view <name>
Refresh fast
Start with sysdate
Next sysdate +1 as
Select *from <master table>;
- Since this is a fast refreshed MVIEW the master table should have a log (Master log) to record the changes on it that can be created by running.
Create materialized view log on master_table;
-This statement creats the following objects
- a table called MLOG$_Master_table
- an internal trigger on Master_table that populates the log table.
* Master Log tables (MLOG$) are used by fast refresh procedure.
CREATE TABLE TEST99 AS SELECT * FROM emp;
CREATE materialized VIEW LOG ON TEST99;
CREATE materialized VIEW mat_view
REFRESH fast
START WITH SYSDATE
NEXT SYSDATE+1 AS
SELECT empno,ename FROM TEST99;
Refreshing Materialized Views:-
- Initially a materialized view contains the same data as in the master table.
- After the MVIEW is created, changes can be made to the master table and possibly also to the MVIEW.
- To keep a MVIEW data relatively current with the data in the master table, the MVIEW must be periodically refreshed.
* Refresh can be accomplished by one of the following procedures.
Dbms_mview.refresh (<mview list>, <Refresh types>)
Dbms _ refresh.refresh (<Refresh Groups>)
Refresh Types -Complete Refresh, Fast Refresh, Force Refresh
* Complete Refresh is performed by deleting the rows from the snapshot and inserting the
rows satisfying the MVIEW query.
* In Fast refresh only the rows updated since last refresh are pulled from the master table to
insert into MVIEW.
* This requires a log table called as MVIEW Log to be created on the Master Table.
* Force refresh first tries to run a Fast refresh if possible.
* If fast refresh is not possible, it performs complete refresh.
BEGIN
Dbms_mview.REFRESH ('mat_view');
END;
Refresh Groups
- These are used to refresh multiple snapshots in a transitionally consistent manner.
- When a refresh group is refreshed all MVIEWS in that group are populated with data from a consistent point in time.
- Refresh groups are managed by using the procedures in the package DBMS – REFRESH.
- DBMS-REFRESH, MAKE of DBMS-REFRESH.ADD are used to create a refresh group and add new snap shots to an existing group.
Types of Materialized Views:-
1 Read-only materialized views
- DML cannot be performed on the snapshots in this category.
2 Up datable materialized views
- These MVIEWS eliminates the restriction of DML’s on snapshots.
3 Sub query materialized views
- These are the MVIEW’S that are created with sub queries in the WHERE clause of a MVIEW query.
4 Row id Vs Primary Key materialized views
- MVIEW’S that use Row id for refresh are called Row id MVIEW’s (Oracle 7).
- MVIEW’S that use primary key for refresh are called primary key MVIE’S
(Oracle 8)
5 Multifier materialized views (Oracle 9)
- In this type MVIEW, its master table itself is a MVIEW.
- This feature enables fast refresh of MVIEW’S that have MVIEW’S as their masters.
- Many companies are structured on at least three levels
A) International
B) National
C) Local
- Many nodes at both the national and local levels are required
- The best possible solution in such cases is to use multifier MVIEW’S.
6 Simple Vs Complex MVIEW’S.
- MVIEW’S being simple or complex determines whether it can be fast refreshed or not.
- A MVIEW is fast refreshable if it is simple.
- A MVIEW is not fast refreshable if it is complex.
- A MVIEW can be considered CONNECT BY, INTERSECT, MINUS or UNION or UNION ALL clauses in its detining query.
* The following data types are not supported in MVIEW replication.
A) LONG B) LONG RAW
C) BFILE D) UROWID
- MVIEW’S are typically used in data ware house or decision support systems.
Snapshots
- Snapshots are mirror or replace of tables in a single point of time.
- A Snapshot is a local copy of a table data that originates from one or more remote master tables.
- To keep a snapshot data current with the data of its master the Oracle server must periodically refresh the snapshot.
VIEWS
- Views are built using the columns from one or more tables.
- The single table view can be updated, but the view with multiple tables cannot be updated.
* A snapshot contains a complete or partial copy of a target master table from a single
point in time.
- A snapshot may be read only or up datable.
26. How duplicate rows are deleted?
- Duplicate rows are deleted by using ROWID
Syntax-- delete from <Table>
Where ROWID not in (Select max (ROWID) from <Table>
Group by <Column name>);
27. How do you call function and procedure in PL/SQL as well as in SQL prompt?
isql*plus EXECUTE < Function/Procedure name > ;
(SQL prompt)
PL/SQL < Procedure Name / Function Name>;
(from another procedure)
Development Tools <Procedure name>;
28. Difference between IN and OUT parameters.
Three types of parameters
1. IN 2. OUT 3.IN OUT
IN parameter:
- This parameter passes a value from the calling environment into the procedure.
- This is the default mode
- A formal parameter of In mode cannot be assigned a value ( we IN parameter cannot be modified in the body of the procedure )
- IN parameters can be assigned a default value in the parameter list.
- IN parameters are passed by reference.
OUT parameters:
- OUT parameter must be assigned a value before returning to the calling environment.
- OUT parameter passes a value from the procedure to the calling environment
- OUT parameter cannot be assigned a default value in the parameter list.
IN OUT parameter:
- These types of parameter pass a value from the calling environment into the procedure and a possibly different value from the procedure back to calling environment using the same parameter.
- IN OUT parameter cannot be assigned a default value. * By default OUT & IN OUT parameters are passed by value.
- These can be passed by reference by using NOCOPY.
29. Triggers:
- A trigger is a PL/SQL block or a PL/SQL procedure associated with a table view schema or the database.
- The code in the trigger executes implicitly whenever a particular event occurs.
Two types of triggers:
Application trigger
- Fires whenever an event occurs with in a particular application
Database Trigger
- Fires whenever a data event (Such as DML) or system event (such as log on or shut down) occurs on a schema or database.
- Executes implicitly when a data event. Such as DML on a table (insert, delete or Update), an INSTEAD OF trigger on a VIEW or DDL statements are issued no matter which user is connected or which application is used.
- Also executes implicitly when some user or data base system actions occur.
- Ex. When user logs on to the system.
When DBA shuts down the database.
- Date base triggers can be defined on tables and on views.
- If a DML operations as issued on a view, the INSTEAD OF trigger defines what action takes place, if these actions include any DML operations on tables, then any triggers on the base tables are fired.
- Data base triggers can be system triggers on a database or a schema.
- With a database, triggers fire for each event for all users, with a schema, triggers fire for each event for the specific user.
Recursive trigger :
- This is a trigger that contains a DML operation changing the very same table.
Cascading Trigger:
- The action of one trigger cascades to another trigger, causing this second trigger to fire.
- Oracle server allows up to 32 triggers to cascade at any one time.
- Changing the value of the OPEN - CORSORS, can change this number. Data bases initialization parameter. (Default value is 50).
- * A triggering statement should contain
1 Trigger Timing Before, After (For Table)
Instead of (For View)
- Determines when the trigger needs to be fired in relation to the triggering event.
2 Triggering Event Insert, Update, Delete
Determines which on the table or view causes the trigger to fire.
3 Trigger Type Statements, Row
Determines how many times the trigger body executes
4 Table name Table, View
5 Trigger body PL/SQL – block
Determines what actions the trigger should perform.
INSTEAD of triggers are used to provide a transparent way to modifying views that
cannot be modified directly through SQL, DML statements because the view is not
modifiable.
INSTEAD of triggers provide writing of Insert, Update and Delete statements against the
view.
The INSTEAD if trigger works invisibly in the background performing the action coded trigger body directly on the underlying tables.
INSTEAD of trigger execute the trigger body instead of the triggering statement.
Statement Triggers
In this type of triggers, the trigger body executes once for the triggering event.
This is the default.
Statement trigger fires once, even if no rows are affected at all.
Row Trigger
- In this type, the trigger body executes once for each row affected by the triggering event.
- Row trigger is not executed if the triggering event affects no rows.
* A view cannot be modified by normal DML if the view query contains set operators,
group functions, group by, connect By, start with clauses or joins.
Mutating Table
- A Mutating table is a table that is currently being modified by an UPDATE, DELETE OR INSERT statement, or a table that might need to be updated by the effects of a declarative DELETE CASCADE referential integrity action.
- A table is not considered mutating for statement triggers.
- A mutating table cannot be changed because the resulting DML could change data that is in consistent state.
What is SQL Trace?
- SQL Trace is the main method for collecting SQL execution information in Oracle collecting a wide range of information and statistics that can be used to tune SQL operations.
- The SQL – Trace facility can be enabled / disabled for an individual session or at the instance level.
- If the initialization parameter SQL-TRACE is set to TRUE in the init.ora of an instance, then all sessions will be traced.
- SQL-TRACE can be set at the instance level by using the initialization parameter SQL-TRACE.
- SQL-TRACE can also be enabled / disabled at the system/session level by using.
Alter system/session set SQL-TRACE = TRUE/FALSE.
Explain Plan
- Explain plan command generates information that details the execution plan that will be used on a particular query.
- A uses a pre created table (PLAN_TABLE) in the current schema to store information about the execution plan chosen by the optimizer.
Creating the plan table
- Plan table is created by using the script utl x plan, sql
(Oracle Home / RDBMS / admin / uti x plan.sql)
Unix $ ORACLE_HOME / rdbms / admin
- This script creates an output table, called PLAN-TABLE for holding the output of the explain command.
Populating the PLAN TABLE
- PLAN TABLE is populated using the explain plan.
SQL> Explain Plan for select * from emp where emp no = 1000;
- This command inserts the execution plan of the SQL statement into the plan table.
- A nametag can be added to explain information by using the set statement_id clause.
Displaying the Execution Plan
- Once the table has been populated, the explain info needs to be retrieved and formatted.
- Numbers of scripts are available to format the plan table data.
$ ORACLE_HOME / rdbms / admin / utlxpls. Sql – to format serial explain plans.
$ ORACLE_HOME/ rdbms/admin/utlxpil. Sql – to format parallel explain plans.
AUTOTRACE
- The AUTOTRACE facility in SQL* plus allows analysts to view the execution plan d some useful statistics for a SQL statement within a SQL*plus session.
- AUTOTRACE needs to be initiated in the SQL*Plus session prior to executing the statement.
SET AUTOTRACE [OPTIONS] [EXPLAIN] [STATISTICS]
- As with the explain plan command, to obtain an execution plan the PLAN-TABLE must be created in the user’s schema prior to Auto Tracing.
SQL> Set Auto trace trace only explain
SQL> Select * from dual;
- To enable viewing of STATISTICS data, the auto-tracing user must have access to dynamic performance tables.
- To achieve this, grant PLUS TRACE role to the user.
PLUS TRACE role is created by the plus trace. Sql script
$ ORACLE_HOME / sql plus admin
SYS user must run this script.
DBA can them grant the role to the users who wish to use the AUTOTRACE.
TK PROF
- Tk prof facility accepts as input a SQL Trace File and produces a formatted output file.
- Tk Prof Filename source filename output EXPLAIN = [user name / password] sys = [yes/no] TABLE = [Table Name]
A) How do you add trace to a report?
- By using the package SRW.TRACE_ADD_OPTION
B) How do you execute a specified DDL in a report?
- BY using the package PW.DO_SQL
C) How do you generate message in reports?
- By using the packages PW.MESSAGE (Reg Num, );
D) Explain BLOBS of CLOBS?
LOB--A LOB is a data type that is used to store large, unstructured data such as text, graphic images, video, clippings etc.
Four large object data types.
BLOB: Represents a binary large object
CLOB : Represents a character large object
NCLOB: Represents a multibyte character object.
BFILE: Represents a binary file store of in an OS binary file outside the database.
LOB’S Internal LOBS (CLOB, BLOB, NCLOB)
external Files (BFILE)
- Depending on the storage aspects and their interpretation by Oracle server.
* LONG_TO_LOB API is used to migrate LONG columns to LOB columns.
LOB’S
LOB Locator
- A table can have multiple LOB columns
- The maximum size of a LOB can be 4 GB
- LOB’S return the locator
- LOB’S store a locator in the table end data in a different segment unless the data is less than 4000 bytes.
LOBLOB value (real data)
LOB locator (pointer to the location of the LOB value)
- A LOB column doesn’t contain the data and it contains the located of the LOB value.
- When a table is created with LOB column, the default storage is ENABLE STORAGE IN ROW.
- If DISABLE storage in Row option is used the LOB value is not stored in the ROW even if the size is less then 4000 bytes.
Internal LOB’S
- Stored inside the Oracle server.
- BLOB, NCLOB, CLOB.
BFILE
- BFILE’S are external LOB’S.
- These are stored in OS files out side the database table spaces.
- The data type is BFILE.
- BFILE data file stores a locator to the physical file.
- BFILE can be GIF, JPEG, MPEG, text or other formats.
*DBMS_LO.READ of DBMS_lob. WRITE are used to manipulate LOBS.
Oracle Applications Architecture
- Internet computing Architecture is a framework for 3-tired, distributed computing that supports Oracle Applications products.
- The Three tiers are
1 Database Tier
2 Application Tier
3 Desk Top Tier
- Database tier manages Oracle 8i database.
- Application tier manages Oracle Applications and other tools.
- Desktop tier provides the user interface displace.
- With Internet computing architecture, only the presentation layer of Oracle Applications is on the Desk Top tier in the form of a plug-in to a standard Internet browser.
TEMPLATE FORM
- The TEMPLATE form is the required starting point for all development of new forms.
- The development of a new form is started by copying the TEMPLATE.fmb file, located in $ AU_top / forms/ us, to a local directory and renaming it as appropriate.
TEMPLATE FORM CONTAINS THE FOLLOWING:-
The AU_TOP/forms/US/TEMPLATE.fmb for developing a new form.
The AU_TOP/forms/US/APPSTAND.fmb contains standard property classes for your runtime platform.
* Platform-independent references to object groups in the APPSTAND form
(STANDARD _PC AND_VA,
STANDARD_TOOLBAR,
STANDARD_CALENDAR)
*Platform – independent attachments of several libraries
FNDSQF - contains routines for Flexfields, Function Security, User Profiles, Message Dictionary.
APPCORE - contains standard User Interface routines.
APPDAYPK - contains the Calendar Widget routines.
*Several form level triggers with requited code
*Program units that include a specification and a body for the package APP_CUSTOM,
Which contains default behaviors for window opening and closing events.
- In general this code should be modified for the specific form under development.
* The application’s color pallet, containing the two colors required by the referenced visual
attributes.
* Many referenced objects that support the calendar, the toolbar, alternative regions and the
menu.
* Template form contains simple objects that show typical items and layout cosmetics.
- These are deleted after developing the form
Blocks: Block Name, Detail Block
Window: Block Name
Canvas_view :Block Name
* Template form includes plat form-independent attachments of several libraries.
- Some of the libraries are attached directly to the TEMPLATE (FNDSQF, APPCORE, APPDAYPK) while the others are attached to these libraries.
APPCORE, APPDAYPK, FNDSQF, CUSTOM, GLOBE, VERT, JA, JE, JL
APPCORE
- Contains the packages and procedures that are required of all forms to support the Menu, Toolbar and other required standard behaviors.
- Procedures and functions in APPCORE have names beginning with APP.
APPDAYPK
- Contains the packages that control the Oracle applications calendar feature.
FNDSQF
- Contains packages and procedures for message dictionary, flex fields, profiles and concurrent processing.
- It also has various other utilities for navigation, MRG, WHO etc.
- Procedures and functions have names beginning with FND.
CUSTOM
- Custom library allows extension of Oracle Applications forms without modification of Oracle applications code.
- Custom library can be used for customizations such as ZOOM (Moving to another form from one form and querying up specific records), enforcing business rules.
Ex: - Supplier name must be in upper case) and disabling fields that are not required for a
particular site.
- All logic must branch based on the form and block for which it is run.
- Oracle applications send events to the Custom library.
Custom code can take effect based on the events.
What is sub query and correlated sub query?
Sub Query: -
- A Sub Query is a SELECT statement that is embedded in a clause of another SQL statements called the parent statement.
- Sub query (Inner Query) returns a value that is used by the outer query.
- Scalar sub query is a sub query that returns exactly one column value from one row.
Correlated Sub Query
- Correlated sub query are used for row–by–row processing.
- Each sub query is executed once for every row of the outer query.
- A correlated sub query is one way of reading (data) every row in a table and comparing values in each row against related data.
- Oracle server performs correlated sub query when the sub query references a column from a table in the parent query.
- The inner query is driven by the outer query in correlated sub queries.
- A correlated sub query is evaluated once for each row processed by the parent statement.
Ex: - Select last_name, salary, department_id from employers OUTER
where salary> (select AVG (Salary) from employees
where department id = outer.department_id);
Types of Joins
1 Equi Join
2 Non-Equi Join
3 Outer Join
4 Self join
Equi Join:-
- Is also called simple or inner join.
- An equi join is a join condition that contains equality sign.
Non Equi Join:-
- It is a join condition that contains something other than the equality operator.
Outer Join: -
- Outer joins are used to also see rows that do not meet the join condition.
- Outer join operator is (+).
- The missing rows can be returned if an outer join operator is used in the join condition.
- The operator (+) is placed on the side of the join that is deficient in information.
- This operator has the effect of creating one or more null rows to each one or more rows from the (join condition) non-deficient table can be joined.
Self Join
- Self-join is used to join a table to itself.
Ex: - to find the name of each employer’s manager.
Which trigger will fire when cursor moves from one block to another block?
WHEN_NEW_BLOCK_INSTANCE
What are the triggers used in CUSTOM.Pll?
CUSTOM.Pll contains (CUSTOM package) the following functions and procedures.
CUSTOM.ZOOM_AVAILABLE FUNCTION
CUSTOM.STYLEFUNCTION
CUSTOM.EVENTPROCEDURE.
* Triggers in Custom.Pll: -
1 WHEN _NEW_FORM_INSTANCE
2 WHEN_FORM_NAVIGATE
3 WHEN_NEW_BLOCK_INSTANCE
4 WHEN_NEW_RECORD_INSTANCE
5 WHEN_NEW_ITEM_INSTANCE
6 ZOOM
7 EXPORT
8 SPECIAL 1-45
9 KEY_Fn (n is a number between 1 and 8)
What is the difference between pre-query and post -query?
* Pre-query executes only once for the statement where as post-query executes for each
record
List of some API’S
FND_PROGRAM.EXECUTABLE
FND_PROGRAM.REGISTER
FND_PROGRAM.PARAMETER
FND_PROGRAM.ADD_TO_GROUP
FND_REQUEST.SUBMIT_REQUEST
FND_PROFILE.VALUE
FND_PROFILE.GET
How to get second parameter value based on first parameter?
$flex $ .value setname.
What is Ref Cursor
Ref cursor is a data type and executed at server side and with ref cursor multiple select statements can be executed.
By increase the binary size, that using control file can increase number of records that are committed.
Forms can be developed in APPS by two ways
A) Customization by extension (using template.fmb)
B) Customization by modification (using custom.pll)
What are the advantages of packages?
Packages bundle related PL/SQL types, items and sub-programs in to one container.
A package should have its specification and body, stored separately in the database.
Specification is the interface to the applications.
A declares the types, variables, constants, exceptions, cursors and sub programs available for use. The body fully defines the cursors and sub programs and so implements the specification.
Once written and compiled the contents can be shared by many applications.
When a packaged PL/SQL construct is called for the first time the whole package is loaded in to memory, thus later calls to constructs in the same package require no disk I/O.
Public package constructs can be referenced from any Oracle server environments.
Private package constructs can be referenced only by other constructs that are part of the same package.
Advantages
1 Modularity
2 Easier Application Design
3 Hiding Information by using public and private.
4 Added functionality.
5 Better performance.
6 Over loading.
Procedures and functions can be over loaded i.e. creating multiple sub programs with the same name in the same package each taking parameters of different number or data type.
How to call WHO columns into the form
By using FND_STANDARD API’S
1. FND_STANDARD.FORM_INFO
Provides information about the form.
Should be called from when-new-form-instance trigger.
2. FND_STANDARD.SET_WHO
Loads WHO columns with proper user information.
Should be called from PRE_UPDATE and PRE_INSERT
Triggers for each block with WHO fields
If this is used FND_GLOBAL need not be called.(FND_GLOBAL.WHO)
3. FND_STANDARD.SYSTEM_DATE
This is a function, which returns date.
Behave exactly like SYSDATE built-in.
4. FND_STANDARD.USER
This is a function, which returns varchar2
Behaves exactly like built in USER.
APPCORE API’S
APP_COMBO
APP_DATE
APP_EXCEPTION
APP_FIELD
APP_FIND
APP_ITEM
APP_ITEM_PROPERTY
APP_NAVIGATE
APP_RECORD
APP_REGION
APP_STANDARD
APP_WINDOW
FNDSQF API’S
FND_CURRENCY
FND_DATE
FND_GLOBAL
FND_ORG
FND_STANDARD
FND_UTILITIES.OPEN_URL
FND_UTILITIES.PARAM_EXISTS
How to call flex fields in the form?
By using FND_FLEX.EVENT (EVENT varchar 2)
How to register an executable and define a concurrent program through backend?
By using concurrent processing API’S
1. FND_CONC_GLOBAL.REQUEST_DATA
. SET_REQUEST_GLOBALS
2. FND_CONCURRENT.AF_COMMIT
. AF_ROLLBACK
. GET_REQUEST_STATUS
. WAIT_FOR_REQUEST
. SET_COMPLETION_STATUS
3. FND_FILE. PUT
. PUT_LINE
. NEW_NAME
. PUT_NAMES
. CLOSE
4. FND-PROGRAM. MESSAGE
. EXECUTABLE
. REGISTER
. PARAMETER
. IN COMPATIBILITY
. EXECUTABLE_EXISTS
5. FND_REQUEST . SET-OPTIONS
.SET_REPEAT_OPTIONS
.SET_PRINT_OPTIONS
.SUBMIT_REQUEST
.SET_MODE
6. FND_REQUEST_INFO . GET_PARAM_NUMBER
. GET_PARAM_INFO
. GET_PROGRAM
. GET_PARAMETER
7. FND_SET . MESSAGE
.ADD_PROGRAM
.ADD_STAGE
.IN COMPATIBILITY
8. FND_SUBMIT. SET_MODE
.SET_REQUEST_STATUS
.SUBMIT_PROGRAM
.SUBMIT_SET
FND_PROGRAM.EXECUTABLE
- is used to define a concurrent program executable
- It takes 8 parameters (all are IN mode)
syntax procedure FND_PROGRAM.EXECUTABLE
(executable IN varchar2,
(Full name) application IN varchar2,
(executable short name) short name IN varchar2,
description IN varchar2 default null
execution_method IN varchar2,
execution_file_name IN varchar2 default null,
(only fol spauned & Immedaite) subroutine_name IN varchar2 default null,
icon_name IN varchar2 default null,
language_code IN varchar2 default (VS)
(for Java Conc Program) execution_file_path IN varchar2 default null,
FND_PROGRAM.REGISTER
- this procedure no used to define a concument program.
- It has 30 IN paranmeters. Out of which 9 are mandatory, the remaining are default.
Syntax procedure FND_PROGRAM.REGISTER
(program IN varchar2,
application IN varchar2,
enabled IN varchar2,
short_name IN varchar2,
description IN varchar2, default null,
( executable_short_name) executable_name IN varchar2
executable_application IN varchar2,
mls_function_shelt_name IN varchar2,
mls_function_application IN varchar2,
inerementor IN varhcar2);
56. How to register a table and columns through back end?
You now register your custom application tables using a PL/SQL
routine in the AD_DD package.
Procedures in the AD_DD Package
Procedure register_table (p_appl_short_name in varchar2,p_tab_name in varchar2,
p_tab_type in varchar2,p_next_extent in number default 512,p_pct_free in number default 10,p_pct_used in number default 70);
Procedure register_column (p_appl_short_name in varchar2,p_tab_name in varchar2,
p_col_name in varchar2,p_col_seq in number,p_col_type in varchar2,p_col_width in number,p_nullable in varchar2,p_translate in varchar2,p_precision in number default null,p_scale in number default null);
Procedure delete_table (p_appl_short_name in varchar2,p_tab_name in varchar2);
Procedure delete_column (p_appl_short_name in varchar2,p_tab_name in varchar2,
p_col_name in varchar2);
p_appl_short_name The application short name of the application that owns the
table (usually your custom application).
p_tab_name The name of the table (in uppercase letters).
p_tab_type Use 'T' if it is a transaction table (almost all application
tables), or 'S' for a "seed data" table (used only by Oracle
Applications products).
p_pct_free The percentage of space in each of the table's blocks reserved
for future updates to the table (1-99). The sum of p_pct_free
and p_pct_used must be less than 100.
p_pct_used Minimum percentage of used space in each data block of the
table (1-99). The sum of p_pct_free and p_pct_used must be
less than 100.
p_col_name The name of the column (in uppercase letters).
p_col_seq The sequence number of the column in the table (the order in
which the column appears in the table definition).
p_col_type The column type ('NUMBER', 'VARCHAR2', 'DATE', etc.).
p_col_width The column size (a number). Use 9 for DATE columns, 38
for NUMBER columns (unless it has a specific width).
p_nullable Use 'N' if the column is mandatory or 'Y' if the column
allows null values.
p_translate Use 'Y' if the column values will be translated for an Oracle
Applications product release (used only by Oracle
Applications products) or 'N' if the values are not translated
(most application columns).
p_next_extent The next extent size, in kilobytes. Do not include the 'K'.
p_precision The total number of digits in a number.
p_scale The number of digits to the right of the decimal point in a
number.
57. How to write to a file through concurrent program.
* By using FND_FILE package and it can be used only for log and output files.
FND_FILE package contains procedures to write text to log and output files.
FND_FILE supports a maximum buffer line size of 32k for both log and output files.
1. FND_FILE.PUT
- This is used to write text to a file with out a new line character
- Multilane calls to FND_FILE.PUT will produce consummated text.
Procedure FND_FILE.PUT (which IN Number,
Buff IN varchar2);
Which log output file
- Can be FND_FILE.LOG or FND_FILE.OUTPUT.
2. FND_FILE.PUT_LINE
- This procedure as used to write a line of text to a file followed by a new line character.
Procedure FND_FILE.PUT_LINE (which IN number,
buff IN varchar2);
EX:- FND_FILE.PUT_LINE( FND_FILE.LOG, find_message_get);
3. FND_FILE.NEW_LINE
- This procedure is used to write line terminators to a file
Procedure FND_FILE.NEW_LINE (which IN number
LINES IN NATURAL:=1);
Ex:- to write two new line characters to a log file
Fnd_file.new_line (fnd_file.log, 2);
4. FND_FILE.PUT_NAMES
- This procedure as used to set the temporary log file and output filenames and the temporary directory to the user specified values.
- This should be called before calling my other FND_FILE procedure and only once per a session.
Function FND_REQUEST.SUBMIT_REQUEST
( application in varchar2 default null,
program in varchar2 default null,
description in varchar2 default null,
start-time in varchar2 default null,
sub_request in bookan default False,
argument1,
arguemnt2,
argument 100) return number;
* If this is submitted from oracle forms, all the arguments ( 1 to 100 ) must be specified.
59. How to display Request ID in the reports?
* By using the parameter P_CONC_REQUEST_ID which needs to be defined always in the reports.
60. How to get username / user id in reports?
P_CONC_REQUEST_ID MUST BE PASSED IN USER PARAMETERS COMPULSORILY.
function BeforeReport return boolean is
begin
SRW.USER_EXIT('FND SRWINIT');
:CP_1:=FND_GLOBAL.USER_ID;
return (TRUE);
end;
function AfterReport return boolean is
begin
SRW.USER_EXIT('FND SRWEXIT');
return (TRUE);
end;
In which directory log and output files are stored?
* APPLCSF is the top level directory in which the concurrent manager puts logs and output files.
* APPLLOG and APPLOUT are the subdirectories in which the concurrent manager puts log and output files.
*APPLCSF variable need to be set in the prod.env (environmental variable), so that all product log files
$ APPLCSF/ $ APPLLOG log files
$APPLCSF/ $ APPLOUT out files
* Concurrent manager log and out put files should go to $ FND_TOP/ $ APPLOG and $ FND _TOP / $APPLOUT if $ APPLCSF is not set.
62. How to submit concurrent programs through OS?
- From the operating system the utility. CONCSUB is used to submit concurrent program.
- This is basically used to test a concurrent program.
- By using the WAIT token. The utility checks the request status every 60 seconds and returns the OS prompt upon completion of the request.
- Concurrent manager does not abort, shutdown or start up until the concurrent request completes.
* If the concurrent program is compatible with it self, it can be checked for data integrity and deadlocks by submitting it many times so that it runs concurrently with it self.
*PL/SQL procedures can submit a request to run a program as a concurrent process by calling.
FND_REQUEST. SUBMIT_REQUEST.
* Before submitting a request, the following functions also should be called optionally.
FND_REQUEST.SET_OPTIONS
FND_REQUEST.SET_REPEAT_OPTIONS
FND_REQUEST.SET_PRINT_OPTIONS
FND_REQUEST.SET_MODE
63. How to check the request status?
- A PL/SQL procedure can check the status of a concurrent request by calling.
FND_CONCURENT.GET_REQUEST_STATUS
FND_CONCURRENT.WAIT_FOR_REQUEST
- FND_CONCURRENT.GET_REQUEST_STATUS
- This function returns the status of a concurrent request
- If the request is already computed, it also returns the completion message.
- This function returns both user friendly (translatable) phase and status values as well as developer phase and status vales that can drive program logic.
Syntax Function FND_CONCURRENT.GET_REQUEST_STATUS
(Request_id in out number,
Application in varchar2 default null,
Program in varchar2 default null,
Phase out varchar2,
Status out varchar,
dev_phase out varchar2,
dev_status out varchar2,
message out varchar2) return BOOLEAN;
- When application and program are specified, the request_id of the last request for the specified program should be returned to request_id.
- Phase, and status values should be taken from
FND_LOOKUPS
dev_phase dev_status
pending normal, standby, scheduled, paused
running normal, waiting, resuming, terminating.
Complete normal, Error, warning, cancelled, terminated
Inactive disabled, on-hold, No-manager, supended
- FND_REQUEST.WAIT_FOR_REQUEST
- This function waits for request completion, then returns the request phase/status and completion message to the caller.
- Goes to sleep between checks for request completion.
Syntax FND_CONCURRENT.WAIT_FOR_REQUEST
( request_id in number default null,
interval in number default 60,
max_wait in number default 0,
phase out varchar2,
status out varchar2,
dev_phase out varchar2,
dev_status out varchar2,
message out varchar2) return BOOLEN;
* FND_CONCURRENT.SET_COMPLETION_STATUS
- this function should be called from a concurrent program to set its completion states.
- This function returns TRUE on success, other wise FALSE.
Syntax function FND_CONCURRENT.SET_COMPLETION_STATUS
(Status in varchar2,
Message in varchar2) return BOOLEAN;
normal
status warning message any message
Error
64. How to generate fmx at OS level?
- Forms can be generated on the forms server as the APPLMGR user.
- Generating the form on the Form server, $ FORM60_PATH
Should be set and the current directory should be $AU_TOP/forms?us.
Syntax $F60 gen userid=apps/apps p module=<form_name>. Fmb
Output_file=<schema_top>/forms?<language>/<form_name>.fmx
Module_type=form bath =no compile_all=special
65. How to convert a form from 4.5 to 6.0? - to upgrade forms, the form can be directly compiled in the next release.
- Form can be compiled by using ifcmp 60.exe
- FLINT 60 bath executable can be used to check whether the form is compatible to Apps or not.
-
66. How to call a form from another form?
- to invoke another form with in a form the function security routines should be used which are available in FND_FUNCTION package.
* for this purpose, CALL_FORM built-in can not be used since the Oracle Applications libraries do not support it.
*FND_FUNCTION.EXECUTE should be used to open a new session of a form (CALL_FORM/ OPEN_FORM do not be used)
*APP_NAVIGATE.EXECUTE procedure also can be used to open a form where an instance of the same form is reused, that has already been opened.
*APP_NAVIGATE.EXECUTE is similar to FND_FUNCTION.EXECUTE, except that it allows a form to be restarted if it is invoked a second time.
*FND_FUNCITON.EXECUTE always starts a new instance of a form.
Syntax procedure APP_NAVIGATE.EXECUTE
(Function_name in varchar2,
open_flag in varchar2 default ‘y’
sesson_flag in varchar2 default ‘SESSION’
other_params in varchar2 default null,
activate_flag in varchar2 default ‘ACTIVATE’
pinned in boolean default FALSE);
syntax Procedure FND_FUNCTION.EXECUTE
(function name in varchar2,
open flag in varhcar2 default ‘y’
session_flag in varhcar2 default’session’
other_params in varchar2 default null,
activate in varchar2 default ‘Active’
browser_target in varchar2 default null);
67. What is the reason for not getting any data when a multi org view is queried?
- To get the data correctly, the xxx-ALL must be referenced and the ORG_ID value should be specified to extract portioned data.
- Using ORG_ID partitions Multiorg views.
- So access through multiorg views will not return any rows, as the CLIENT_INFO Value is not set
- Use HR_OPERATING UNITS to identify the organization _id of the OU on which query is based.
- Use FND_CLIENT_INFO package to set the value in CLIENT INFO using set_org_context.
• Execute dbms_application_info.set_client_info (‘Org_Id’)
• Execute fnd_client_info. Set_org_context (‘<org_id>’);
- Now querying of multiorg views can be done.
68. How do you find that muliorg is installed?
- Multi organization architecture is meant to allow multiple companies or subsidiaries to store their records with in a single database.
- Multiple organizations Architecture allow this by partitioning data through views in APPS schema.
- Implementation of Multi org generally includes more than one business group.
* To know whether multiorg is existing or not
Select multi_org_flag from fnd_product_groups)
- If the result is ‘Y’ means the database is group for multiorg
69. What are the triggers that fire on item?
2. Pre_Text_Item
3. When_New_Item_Instance
4. Post_text_Item
5. Post_Change
6. When_validate_Item
7. Key_Next_Item
70. Transactional triggers in forms
- Transactional triggers are the triggers that are related to accessing a data source.
- These triggers fire for each record that is marked for insert, update or table when forms would typically insert. Update of delete statements.
- Internally forms would be calling its internal insert_record, update_Record and Delete_Record built-ins as appropriate to perform the default processing.
* Important Transaction triggers are
1. ON_LOCK
2. ON_UPDATE
3. ON_INSERT
4. ON_DELETE
71. Which triggers will fire when cursor moves from one block to another block?
Trigger Firing Order Level
1. Post_Test_Item Item
2. Post_Record Block
3. Post_Block Block
4.When_Create_Record Block
5. Pre_ Block Block
6. Pre_Record Block
7. Pre_Text.Item Block
8.When_New_Block_Instance Block
9.When_New_Record_Instance Block
10.When_new_Item_Instance Form
72. What is the difference between PRE_COMMIT and POST_COMMIT triggers?
* ‘POST_FORMS_COMMIT triggers is the new name for the POST_COMMIT triggers.
*When a form is being committed the following triggers are fired
(i) PRE_COMMIT (ii) ON_COMMIT (iii) POST_COMMIT
Pre – Commit Trigger
This trigger fires once during the Post and Commit transaction process. Before form builder processes any (changes) records to change.
Specifically it fires after form builder determines that there are inserts, updates or deletes in the form to post or commit, but before it commits the changes.
This trigger doesn’t fire when there is an attempt to commit, but validation determines that there are no changed records in the form.
This is a form level trigger.
Enter query mode should be set as ‘No’
This can be used to perform an action, such as setting up special locking requirements, at any time a database commit is going to occur.
If this trigger fails, the post and commit processes fail, no records are written to the database and focus remains in the current item.
If a DML is performed in a pre-commit trigger and it fails, ten manual rollback must be performed, because form builder doesn’t perform an automatic roll back.
This trigger fires in post and commit transactions.
Post – Commit Trigger
This is also known as post-commit trigger.
Post-commit trigger fires once during the post and commit transactions.
If there are records in the form that have been marked as inserts, updates or deletes, the post-forms-commit trigger fires after these changes have been written to the database but before form builder issues the database commit to finalize the transaction.
If the operation or application initiates a commit when there are no records in the form have been marked as inserts, updates or deletes, form builder fires post-forms-commit trigger immediately, without posting changes to the database.
This is a form level trigger.
Enter query mode should be set to ‘No’
Post-forms-commit trigger should be used to perform an action, such as updating an audit trial any time a database commit is about to occur.
If this trigger fails, post and commit processing aborts and form builder issues a ROLLBACK and decrements the internal save point counter.
This trigger fires in Post and Commit transactions.
What is decode function?
*Decode function decodes an expression in a way similar to the IF_THEN_ELSE logic used in various languages.
Decode function decodes expression after comparing it to each search condition.
If the expression is the same as search, result is returned.
If the default value is committed, a null value is returned where a search value does not match any of the result values.
DECODE function facilitates conditional inquiries by doing the work of a CASE or IF_THEN_ELSE statement.
DECODE (column, expression, search1, result1, search2, result2, …..);
Ex:- Select last_name, job, alary,
DECODE ( ‘IT_PROG’, 1.10*SALARY,
‘ST_CLERK’, 1.15*SALARY,
‘ST_REP’, 1.20*SALARY,
SALARY) REVISED_SALARY from employees;-*/
How to call a Report in two applications?
*SRW Package is a collection of PL/SQL constructs that contain many functions, procedures and exceptions that can be referenced in Reports.
1 SRW.Break 2. SRW.Context_Failure
3 SRW.Do_SQL 4. SRW.Do_SQL_Failure
5 SRW.Get_Page_Num 6 SRW.Message
7 SRW.Program_Abort 8 SRW.Refrence
9 SRW.Run_Report 10 SRW.Run_report_Failure
11 SRW.Set_Altr 12 SRW.Integer_Error
13 SRW.Set_Field_char 14 SRW.Set_Field_Num
15 SRW.Set_Maxrow 16 SRW.Trace_Add_Option
17 SRW.Trace_End 18 SRW.Trace_Start
19 SRW.User_Exit 20 SRW.User_Exit_Failure
SRW.Run_Report
SRW.Run_Report (command_line, char);
Executes specified R25 RUN Command
SRW.RUN_REPORT_FAILURE;
Stops report execution when failure of SRW.Run_Report occurs.
By using SRW.Run_Report, another report can be called to the screen from a button with in one report.
If this is used from a Report Trigger, BATCH=YES must be passed.
* DESTYPE can only be FILE, PRINTER or MAIL.
Ex:- Function F1 return Boolean is
Begin
SRW.RUN_REPORT (‘Report=Rep_A P_Param1=20’);
-- calls Report Rep-A and displays to screen
-- Passes a parameter 20 to the param_1
Exception
When SRW.RUN_REPORT_FAILURE Then
SRW. Message (100, ‘Error Calling Report’);
Raise SRW.Program_Abort;
Return True;
End;
* SRW.DO_SQL (sql statement char); - Executes specified SQL statement
* SRW.DO_SQL_FAILURE; - Stops report execution upon SRW.Do_SQL failure.
* SRW.Message (msg_number number, msg_text char);
Displays a specified message and message number
* SRW.Program_Abort;
Stops execution of report when raised.
* SRW.Set_Altr
Applies attribute settings, such as font, color to lay out objects.
This procedure applies formatting attributes to the current frame, repeating frame, field or boiler plate object.
* SRW.Set_Altr (object_id number, altr SRW.Generic_Altr);
object _id is always zero.
Altr is SRW.Altr (that is, the attributes to change)
* SRW.set_Field
The procedures in this package are very useful in format triggers.
They are used to change data that will be displayed ion a particular item based on a specific condition.
SRW.Set_Field_char (Object_id, text char);
SRW.Set_Field_Date (Object_id, date date);
SRW.Set_Field_ Num (Object_id, number number);
Can a Report contain more than one template?
Templates define common characteristics and objects that can be applied to multiple reports.
For example template can be defined that include the company logo and sets font colors for selected areas of a report.
When a report is created through the Report Wizard, there is an option of applying a template (.tdf file) to the report.
When a template is chosen, objects in the margin area of a template are imported into the same locations in the current report section, over writing any objects if exists.
The characteristics of the objects in the body area of the template are applied to objects in the body area of the template are applied to objects in the body area of the current report section.
Any template properties, parameters, report triggers, program units and attached libraries are also applied.
Different (Multiple) templates can be applied to each section of the report.
If another template is applied later to a report the existing template objects will be deleted in the current report section.
How to add a template to the predefined templates list?
i) In a text editor open the Preferences File
ii) Scroll down to the template descriptions identified by Reports. Xxx – Template_Reso (who xxx specified a Report style) (Tabular, Break Above)
iii) For each Report style for which the template is defined
- To the Reports.xxx – Template_Disc list, add the description that should be appeared on the template page of the report wizard.
- To the corresponding Reports. XXX_template_file list; add the file name of the template in the same position as the addition that is made to the description list.
iv) copy the template file (file name.tdf) to
ORACLE_HOME/REPORT 60/ADMIN/TEMPLATE/US
Preferences file: -
Windows ORACLE_HOME\CAUPREFS.ORA (user preferences)
ORACLE_HOME\CAGPREFS.ORA (Global Preferences)
Unix HOME_DIRECOTRY/Prefs.ora (User preferences)
$ORACLE_HOME/tools/admin/prefs.ora(Global Preferences)
78. How to pass a parameter in a request set for three concurrent programs, which are having same parameter?
i) For the first report in the Report set, click on the parameters button and ender the parameters that are to the shared by all reports in the Request (Report) set.
ii) Go to the nest report and click the parameters button and list the same shared parameters.
iii) Do the above step for each and every report in the request set
Iv)’Modify’ check box can be used to allow the users to change the values of the parameters in the ‘lower ’reports at submission time..
v) ‘Display) check box can be used to allow the users to see the parameter values at submission time.
* Request set wizard can be used to quickly create a new Request set in which all of the request run sequentially or all of the request run in parallel.
* Sequentially One after another
* Parallel All at once.
- The action can be set whether to continue processing or abort processing. If a request ends with the statues ‘Error’.
-
79. What are Global variables in Reports?
*Global variables are the variables that can be assigned to parameters in reports and those parameters can be used in reports
create_parameter_list (------)
add_parameter (----:Global_var);
run_product(….);
80. What are Handlers?
* Handler is a group of packaged procedures, which is used by Oracle Applications to organize. PL/SQL code in forms.
- Handlers provide a way to centralize the code so that it becomes easier to develop, maintain and debug.
- The packaged procedures available in a handler are called form the triggers by passing the name of the trigger as an argument for the procedure to process.
* Handlers are types: - 1) Item Handlers
2) Event Handlers
3) Table Handlers
4) Business Rules
- Handlers reside in program units in the form or in stored packed in the database.
Adding Table handler Logic
Coding logic for window and alternative region control.
Adding find-windows and/or ROW-LOV’S and enable query-find.
Coding logic for item relations such as dependent fields.
Coding messages to use message dictionary.
Adding FF logic if required.
Adding choices to the special mence and logic to modify choices the default menu and tool bar behavior is necessary.
Coding any other logic.
Creating a form function for the developed form and registering any sub functions.
Testing the form by it self.
Registering the form with AOL.
Adding the form function to a menu or creating custom mence.
Assigning the menu to the responsibility and assigning the responsibility to the user.
Testing the form within Oracle Applications.
Registering of Application, form and a concurrent program through Application developer Responsibility
Application:-
Responsibility Application Developer
<Application / Register >
Form:-
<Application / Form>
<Application / Function>
Menu:-
<Application / Menu>
Messages:-
<Application / Messages>
Table:-
<Database /Table>
Sequence:-
<Database / View>
Concurrent Program: -
<Concurrent / Executable>
<Concurrent / Program>
Application Developer (Responsibility)
*Flex field
+Key
+Descriptive
-Test
*Concurrent
-Program
-Executable
-Library
*Application
-Register
-Form
-Function
-Menu
-Messages
+Database
+Lookups
+Validation
*Profile
*Attachments
- Document Entities
- Document Categories
- Attachment Functions
*Other
*Requests
- Run
-Set
-Profile
-Concurrent
-Change Organization
-Running Jobs
+Key +Descriptive
-Register -Register
-Segments -Segments
-Aliases -Values
-Cross Validation
-Values +Lookups
-Groups -Application Object Library
-Accounts -Common
+Database +Validation
-Table -Set
-View -Values
-Sequence
Lexical references cannot be made in Pl/SQL statements.
Bind references can be done in PL/SQL statements.
Lexical parameters can be referenced by entering an ampersand ( ) followed immediately by the column name or parameter.
Before creating the query, a column or parameter in the data model should be created for each lexical reference in the query.
For lexical parameters, initial value must be defined so that report builder uses this value to validate the query with a lexical reference.
Token
If Oracle reports are executed by a concurrent program, (for Oracle Reports Program), then a keyword or a parameter with the same name as in the report builder, should be defined which for each parameter, which is known as taken.
This is used to pass the parameters to the reports from the application (SRS Window)
Request Set
Request set is the group of requests, that can be submitted regularly using a single transaction.
Incompatibility
These are the list of programs that can be defined as incompatible with a pertain program.
If any program is defined as incompatible to a particular program, then that program should not run simultaneously with the concurrent program, because they might interfere with its execution.
Application Developer Responsibility
Various Screens
Different Executable Methods
1 Host
2 Immediate
3 Java Stored Procedure
4 Java Concurrent Program
5 Multi Language Function
6 Oracle Reports
7 PL/SQL stored Procedure
8 Request set stage function
9 Spawned
10 SQL*Loader
11 SQL*Plus
<Concurrent/Library> Concurrent Library
Library types Transaction Library
<Lookups>
User
Access Levels Extensible
System
<Validation/Set>
List of values
List types Long List of Values
Pop list
No security
Security type Hierarchical Security
Non- hierarchical Security
Char
Format type Date
Date time
Number
Standard date
Standard date time
Time
Validation types Respondent
Independent
None
Pair
Special
Table
Translatable Independent
Translatable Dependent
<Attachments / Attachment Functions>
function
type form
report
85. What is a Data Group?
- A data group is a group of oracle applications and the Oracle ID of each application
- Oracle ID grants access privileges to tables in an Oracle Database
- Data group determines which Oracle Data base accounts responsibilities forms, concurrent programs and reports connect to.
86. What is a Responsibility?
- Responsibility defines Applications Privileges.
- A responsibility is a level of authority in Oracle Applications that lets users to use only those Oracle Applications functions and data appropriate to their roles in an organization.
- Each user has at list one or more responsibilities and several users can share the same responsibility.
* Each responsibility allows access to
- A specific application or a set of applications.
- A set of books.
- A restricted list of windows that a user can navigate.
- Reports in a specific application.
87. What are security Attributes?
- Security Attributes are used by Oracle self-service web Applications to allow rows of data to be visible to specified users responsibilities based on the specific data contained in the row.
88. What is a Profile Option?
- Profile options are the set of changeable options that affects how the application looks and behaves.
- By setting profile options, the applications can be made to react in different ways for different users depending on the specific user attributes.
89. What are steps involved in developing a flex field?
- Designing the table structure
- Creating fields on the form (Visible/Hidden)
- Calling appropriate routines
- Registration of the flex field.
- Definition of the flex field.
<Flex fields / key/ Register>
<Flex fields/Descriptions / Register>
90. What is an application /Module?
- Application is a collection of forms, function and menus.
91. What are Alerts?
- Alert is a mechanism that checks the database for a specific exception condition.
- The SQL select statements it contains characterize an alert.
- A SQL select statement fells the application what database exception to identify as well as what output to produce for that exception.
92. What are composite Data types?
* Composite Data types are of two types
1. PL/SQL Records
2. PL/SQL Collections
Index By Table
Nested Table
VARRAY
* Composite data types are also known as collections
- They are RECORD, TABLE, NESTED TABLE and VARRAY
RECORD data type:-
- A RECORD is a group of related data items stored as fields each with its own name and data type.
- PL/SQL Records are similar to structures in 3GL’s
- A RECORD is not the same as Row in a database table
- RECORD treats a collection of fields as a logical unit.
- These are (RECORD type) convenient for fetching a row of data from a table for processing
- RECORDS also can be declared.
Syntax TYPE type_name is RECORD
(Field declaration…);
identifier type_name;
Ex:- TYPE emp_record_type is RECORD
last_name varchar2(50),
job_id varchar2(10),
salary number*8,2));
emp_record emp_ record_type;
- fields declared as NOT NULL must be initialized.
INDEX BY Table data types: -
* This data type contains two components.
1. Primary key of data type BINARY_INTEGER
2. Column of scalar or record data type.
* Objects of the TABLE type are called INDEX BY Tables
- They are modeled as (but not the same as) data base tables.
- INDEX BY Table is a primary key to provide the user with array-like access to rows.
- INDEX BY table is similar to an ARRAY.
- It can be increased in size dynamically because they are unconstrained.
* There are two steps involved in creating an INDEX BY table.
1. Declare a TABLE data type.
2. Declare a variable of that type.
- The size of the INDEX BY Table is unconstrained increase dynamically so that INDEX BY Table grows as new rows are added.
- INDEX BY Tables can have one column and a unique identifier to that one column neither of which can be named.
- The column can belong to any scalar or record data type, but the primary key must be ling to type BINARY_INTEGER
- INDEX BY Tables cannot be initialized at the time of its declaration and also it cannot be populated at the time of declaration.
- An exploit executable statement is required to initialize (populate) the INDEX BY TABLE.
Syntax TYPE ename_table_type IS TABLE OF
Employees.last_name%TYPE
INDEX BY BINARY_INTEGER;
-this can be referenced by
INDEX Bytable_name (primary_key_value);
- The Following methods are used with INDEX BY Tables.
1. EXISTS
2. OUNT
3. FIRST AND LAST
4. PRIOR
5. NEXT
6. TRIM
7. DELETE
INDEX BY Table of Records:
- At a given point of time. INDEX BY Table can store only the details of any one of the columns of a database table
- To store all the columns retrieved by a query, INDEX BY Table of Records is used.
- Because only the table definition is needed to hold information about all of the fields of a data base table, the table of records greatly increases the functionality if INDEX BY Table.
EXAMPLE:
DECLARE
TYPE ename_table_type IS TABLE OF
Emp.ename%TYPE
INDEX BY BINARY_INTEGER;
ename_rec ename_table_type;
CURSOR c1 IS SELECT ename FROM emp;
i INTEGER:=0;
BEGIN
FOR emp_rec IN c1 LOOP
ename_rec(i):=emp_rec.ename;
i:=i+1;
END LOOP;
FOR i IN ename_rec.first..ename_rec.last LOOP
dbms_output.put_line(ename_rec(i));
END LOOP;
END;
NESTED TABLE:
CREATE OR REPLACE TYPE PERSONAL_INFO AS OBJECT
(SEX VARCHAR2(20),
AGE NUMBER,
NATIONALITY VARCHAR2(20));
CREATE TYPE INFO IS TABLE OF PERSONAL_INFO;
CREATE TABLE EMP_INFO
(ENAME VARCHAR2(20),
PERSONAL INFO)
NESTED TABLE PERSONAL STORE AS PERSONAL_TABLE_INFO;
INSERT INTO EMP_INFO
VALUES ('sachin',info(PERSONAL_INFO('male',12,'indian')));
SELECT ENAME, A.*
FROM EMP_INFO,TABLE (EMP_INFO.PERSONAL) A
VARRAY :
CREATE OR REPLACE TYPE INFO_VARRAY AS VARRAY(5) OF VARCHAR2(30);
CREATE TABLE VARRAY_TAB
(ENAME VARCHAR2(30),EMPNO INFO_VARRAY)
INSERT INTO VARRAY_TAB VALUES('DOR',INFO_VARRAY('DD','AA','FF'));
SELECT ENAME,T.*
FROM VARRAY_TAB, TABLE(VARRAY_TAB.EMPNO) T;
93. What do you mean by SQL Loader, and its Advantage?
SQL*Loader is a server utility for loading data from external data files into Oracle database. The basic advantage of using SQL*Loader is for simple loads and fast loading of data. It can load data into myraid data formats, perform elementary filtering, load data into multiple tables, and create one logical record from one or more physical records. It creates a detailed log file, a bad file that contains rejected records and a discard file to hold the records that are selectively not loaded.
94. Define First Normal Form (1NF)?
The first normal form (1NF) requires that data in tables be two-dimensional – that there be no repeating groups in the rows.
95. Define Second Normal Form (2NF)?
The second normal form (2NF) requires that data in tables depends on the whole key of the table.
96. Define Third Normal Form (3NF)?
The third normal form (3NF) requires that the data in tables depends on the primary key of the table.
97. What is OCI?
OCI is Oracle Call Interface. When applications developers demand the most powerful interface to the Oracle Database Server, they call upon the Oracle Call Interface(OCI).
98. Difference between database triggers and form triggers?
Database triggers are fired whenever any database action like INSERT, UPATE, DELETE, LOGON LOGOFF etc occurs. Form triggers on the other hand are fired in response to any event that takes place while working with the forms, say like navigating from one field to another or one block to another and so on.
99. What are ORACLE PRECOMPILERS?
A precompiler is a tool that allows programmers to embed SQL statements in highlevel source programs like C, C++, COBOL, etc.
100. What is difference between a formal and an actual parameter?
The formal parameters are the names that are declared in the parameter list of the header of a module. The actual parameters are the values or expressions placed in the parameter list of the actual call to the module.
101. Can cursor variables be stored in PL/SQL tables. If yes how. If not why?
Yes. Create a cursor type - REF CURSOR and declare a cursor variable of that type.
DECLARE
/* Create the cursor type. */
TYPE company_curtype IS REF CURSOR RETURN company%ROWTYPE;
/* Declare a cursor variable of that type. */
company_curvar company_curtype;
/* Declare a record with same structure as cursor variable. */
company_rec company%ROWTYPE;
BEGIN
/* Open the cursor variable, associating with it a SQL statement. */
OPEN company_curvar FOR SELECT * FROM company;
/* Fetch from the cursor variable. */
FETCH company_curvar INTO company_rec;
/* Close the cursor object associated with variable. */
CLOSE company_curvar;
END;
102. What is use of a cursor variable? How it is defined?
Cursor variable is used to mark a work area where Oracle stores a multi-row query output for processing. It is like a pointer in C or Pascal. Because it is a TYPE, it is defined as TYPE REF CURSOR RETURN ;
103. What WHERE CURRENT OF clause does in a cursor?
The Where Current Of statement allows you to update or delete the record that was last fetched by the cursor.
104. What is the purpose of a cluster?
A cluster provides an optional method of storing table data. A cluster is comprised of a group of tables that share the same data blocks, which are grouped together because they share common columns and are often used together. For example, the EMP and DEPT table share the DEPTNO column. When you cluster the EMP and DEPT, Oracle physically stores all rows for each department from both the EMP and DEPT tables in the same data blocks. You should not use clusters for tables that are frequently accessed individually.
105. What is a pseudo column. Give some examples?
Information such as row numbers and row descriptions are automatically stored by Oracle and is directly accessible, ie. not through tables. This information is contained within pseudo columns. These pseudo columns can be retrieved in queries. These pseudo columns can be included in queries which select data from tables. Available Pseudo Columns
ROWNUM - row number. Order number in which a row value is retrieved. ROWID - physical row (memory or disk address) location, ie. unique row identification.
SYSDATE - system or today’s date.
UID - user identification number indicating the current user.
USER - name of currently logged in user.
105. What is difference between Rename and Alias?
Rename is actually changing the name of an object whereas Alias is giving another name (additional name) to an existing object.
106. What are the Oracle standard reports in OM module & what purpose they are used?
107. Life Cycle of the OM Module with Tables?
Process | Table | view | ||||||||||||||||||||||||
+Profile Options | fnd_profile_options | FND_PROFILE_OPTIONS_VL | ||||||||||||||||||||||||
fnd_profile_options_tl | ||||||||||||||||||||||||||
GL Calendar | gl_period_statuses | GL_PERIOD_STATUSES_V | ||||||||||||||||||||||||
Inv calendar | org_acct_periods | ORG_ACCT_PERIODS_V | ||||||||||||||||||||||||
Purchasing calendar | GL_PERIOD_STATUSES | |||||||||||||||||||||||||
bom calendar | BOM_CALENDARS | |||||||||||||||||||||||||
item | mtl_system_items_b | |||||||||||||||||||||||||
mtl_system_items_tl | mtl_system_items_fvl | |||||||||||||||||||||||||
Payment terms | ra_terms_tl | |||||||||||||||||||||||||
ra_terms_b | ra_terms_vl | |||||||||||||||||||||||||
profile class | hz_cust_profile_classes | AR_CUSTOMER_PROFILE_CLASSES_V | ||||||||||||||||||||||||
hz_cust_prof_class_amts | AR_CUST_PROF_CLASS_AMOUNTS | |||||||||||||||||||||||||
collector | AR_COLLECTORS | |||||||||||||||||||||||||
pricelist | qp_list_headers_tl | qp_secu_list_headers_v | ||||||||||||||||||||||||
qp_list_headers_b | ||||||||||||||||||||||||||
qp_pricing_attributes | ||||||||||||||||||||||||||
qp_list_lines | qp_list_lines_v | |||||||||||||||||||||||||
Miss.Trans | mtl_material_transactions | |||||||||||||||||||||||||
Wfb | ra_interface_lines_all ra_interface_distributions_all | |||||||||||||||||||||||||
AUTOINVOICE | ra_customer_trx_all ra_customer_trx_lines_all ra_cust_trx_line_gl_dist_all ra_cust_trx_line_salesreps_all ar_receivable_applications_all ar_payment_schedules_all ra_batches_all | |||||||||||||||||||||||||
MTL_TXN_REQUEST_HEADERS_V | ||||||||||||||||||||||||||
DROPSHIPMENT |
|
108. Relationship between wsh_delivery_details and oe_order_headers_all table?
109. In PO module where OM comes into picture?
110. In OM Module where PO comes into picture?
111. What is Pick Release where it is used with Example?
112. When Before Report Trigger is not fired?
113. If we want to create a table in Report how do you do that?
114. What is Request Security Groups?
115. What is Move Order How we create Move Order and where it is used?
116. What are the require things in Sales Order?
117. DFF registration in Forms?
118. How do you define Query Find window in your form?
119. What is the Directory Structure on the server side?
SERVER – SIDE DIRECTORY TREE TO STORE FILES
Bin: Contains executable code of your concurrent programs written in a programming
language such as C, Pro*C, Fortran, or an operating system script.
Lib: Contains compiled object code of your concurrent programs.
SQL: Contains concurrent programs written in SQL*Plus and PL/SQL scripts.
Rpt: Contains concurrent programs written with SQL*Reports.
Log: Contains log files from concurrent programs.
Forms/(Language): Each language has a subdirectory (such as US). The language
subdirectory holds the forms .fmx files.
Srw: Contains concurrent programs written with Oracle Reports.
Out: Contains output files from concurrent program.
Mesg: Holds your application message files for Message dictionary.
PLSQL: Contains PL/SQL libraries used with Oracle reports.
120. What are the salient features of AOL and Sysadmin functions?
Application Object Library is the Library that contains all the Objects of an Application. For Oracle Apps.
Salient Features –
- Registering Tables with Oracle Apps.
- Registering Forms with Oracle Apps.
- Registering Concurrent Programs with Oracle Apps.
- Building Menus.
- Building Flexfields.
- Enabling Zoom.
- Building Message Dictionary.
SYSTEM ADMINISTRATION
- Manage Oracle Applications security.
- Manage Concurrent programs & Reports.
- Manage Concurrent processing.
- Manage Printers.
- Manage Profile Options.
- Manage Document Sequences.
121. What is a Concurrent Program?
An instance of an execution file, along with parameter definitions and incompatibilities.Several concurrent programs may use the same execution file to perform their specific tasks,each having different parameter defaults and incompatibilities.
An executable program or report in Oracle, which is executed in the background, and allows user to continue with other work while the job is being executed.
122. What is a Concurrent Program Executable?
An executable file that performs a specific task. The file may be a program written in a standard language, a reporting tool or an operating system language.
123. What is a Concurrent Request?
A request to run a concurrent program as a concurrent process.
124. What is a Concurrent Process?
An instance of a running concurrent program that runs simultaneously with other concurrent processes.
125. What is a Concurrent Manager?
A program that processes user’s requests and runs concurrent programs. System
Administrators define concurrent managers to run different kinds of requests.
126. What are the phases and statuses through which a concurrent prequest runs through?
Phases:-
Pending - Request is waiting to be run
Running - Request is running
Completed - Request has finished
Inactive - Request cannot be run
Phase Status Description
PENDING Normal Request is waiting for the next available manager.
Standby Program to run request is incompatible with other program(s) currently running.
Scheduled Request is scheduled to start at a future time or date.
Waiting A child request is waiting for its Parent request to mark it
ready to run. For example, a report in a report set that runs
sequentially must wait for a prior report to complete.
RUNNING Normal Request is running normally.
Paused Parent request pauses for all its child requests to complete.
For example, a report set pauses for all reports in the set to
complete.
Resuming All requests submitted by the same parent request have
completed running. The Parent request is waiting to be
restarted.
Terminating Running request is terminated, by selecting Terminate in the Status field of the Request Details zone.
COMPLETED Normal Request completes normally.
Error Request failed to complete successfully.
Warning Request completes with warnings. For example, a
report is generated successfully but fails to print.
Cancelled Pending or Inactive request is cancelled, by selecting
Cancel in the Status field of the Request Details zone.
Terminated Running request is terminated, by selecting Terminate in the Status field of the Request Details zone.
INACTIVE Disabled Program to run request is not enabled. Contact
your system administrator.
On Hold Pending request is placed on hold, by selecting Hold
in the Status field of the Request Details zone.
No Manager No manager is defined to run the request. Check
with your system administrator.
127. What is the difference between Request group and request set?
A request group is a collection of reports or concurrent programs. Only a System Administrator can create a request group. Request groups can be used to control access to reports
Request sets define run and print options, and possibly, parameter values, for a
collection of reports or concurrent program.
Standard Request Submission and Request Groups
Standard Request Submission is an Oracle Applications feature that allows you to select and run all your reports and other concurrent programs from a single, standard form.
128. What are exceptions in Utl_file?
There are 7 types of exceptions in UTL_FILE
- Invalid_Path
- Invalid_Mode
- Invalid_FileHandle
- Invalid_Operations
- Read_Error
- Write_Error
- Internal_Error
Subscribe to:
Posts (Atom)