|
Q:
Give the structure of the trigger?
|
|
A:
Triggers are simply stored procedures that are ran automatically by the database whenever some event happens. The general structure of triggers is: CREATE [OR REPLACE] TRIGGER trigger_name BEFORE (or AFTER) INSERT OR UPDATE [OF COLUMNS] OR DELETE ON tablename [FOR EACH ROW [WHEN (condition)]] BEGIN ... END;
|
|
|
Q:
What is an autonomous transaction ?
|
|
A:
An autonomous transaction is an independent transaction that is initiated by another transaction (the parent transaction). An autonomous transaction can modify data and commit or rollback independent of the state of the parent transaction.
|
|
|
Q:
What are the different cursors available in PL/SQL ?
|
|
A:
Explicit Cursors, Implicit Cursors, Ref Cursors
|
|
|
Q:
How do you submit a concurrent program from PL/SQL Procedure?
|
|
A:
FND_REQUEST.SUBMIT_REQUEST()
|
|
|
Q:
What is the difference between View and Materialized view?
|
|
A:
Materialized view will not be refreshed everytime you query the view so to have good performance when data is not changed so rapidly we use Materialized views rather than normal views which always fetches data from tables everytime you run a query on it.
|
|
|
Q:
What is RAISE_APPLICATION_ERROR used for?
|
|
A:
The RAISE_APPLICATION_ERROR is a procedure defined by Oracle that allows to raise an exception and associate an error number and message with the procedure.
|
|
|
Q:
What are the three files that are generated when you load data using SQL Loader?
|
|
A:
.log .bad .discard
|
|
|
Q:
What is dynamic SQL?
|
|
A:
Dynamic SQL allows you to construct a query, a DELETE statement, a CREATE TABLE statement, or even a PL/SQL block as a string and then execute it at runtime.
|
|
|
Q:
What are the types of Exceptions?
|
|
A:
System defined and user defined Exceptions
|
|
|
Q:
What are the differences between Function and Procedure?
|
|
A:
Function has to return a value where procedure may or maynot return values. Function can be used in SQL statements and procedures can not.
|
|
|
Q:
What is the difference between TRUNCATE and DELETE?
|
|
A:
TRUNCATE will completely erase the data where as in DELETE you have the option to delete only few rows. TRUNCATE is DDL command where as DELETE is DML command
|
|
|
Q:
How do you set the profile option from a PL/SQL procedure?
|
|
A:
No answer yet!
|
|
|
Q:
Name the different database triggers?
|
|
A:
No answer yet!
|
|
|
Q:
What is the SQL statement used to display the text of a procedure stored in database?
|
|
A:
select text from dba_source where name = 'Procedurename'
|
|
|
Q:
How do you retrieve the last N records from a table?
|
|
A:
No answer yet!
|
|
|
Q:
Can you use COMMIT in a trigger?
|
|
A:
Yes but by defining an autonomous transaction.
|
|
|
Q:
What is Ref Cursor?
|
A:
A ref cursor is a variable, defined as a cursor type, which will point to a cursor result. The advantage that a ref cursor has over a plain cursor is that is can be passed as a variable to a procedure or a function. Ref Cursors are of 2 types: Weak and Strong. In the case of Strong type, the data type of the returned cursor result is defined whereas in Weak type, it is not defined.
Eg:type erp_cursor is ref cursor; -- weak type erp_cursor is ref cursor returning erp%rowtype; --strong
declare 2 type erp_cursor is ref cursor; 3 c1 erp_cursor; 4 r_c1 articles%rowtype; 5 r2_c1 scripts%rowtype; 6 7 begin 8 open c1 for select * from articles; 9 fetch c1 into r_c1; 10 close c1; 11 open c1 for select * from scripts; 12 fetch c1 into r2_c1; 13 close c1; 14 end;
|
|
|
Q:
Can triggers be used on views? If so How?
|
A:
Yes only INSTEAD OF trigger can be used to modify a view. CREATE OR REPLACE TRIGGER trigger_name INSTEAD OF INSERT ON view name begin ... end;
|
|
|
Q:
Can you call a sequence in SQL Loader?
|
|
A:
Yes
|
|
|
Q:
How do you declare user defined Exception?
|
|
A:
Declare ... Excep_name exception; procedure Excep_name is begin raise some_exc; end Excep_name; Begin .... end;
|
|
|
Q:
How do you eliminate duplicate rows from a table?
|
|
A:
No answer yet!
|
|
|
Q:
What is a mutating table?
|
|
A:
No answer yet!
|
|
|
Q:
"UPDATE …..; CREATE TABLE E(….); ROLL BACK;" To which save point will the changes be Rolled Back?
|
|
A:
Updates done wouldn't be Rolled Back as CREATE statement which is a DDL would issue a COMMIT after the creation of the table.
|
|
|
Q:
What is tkprof and the syntax?
|
|
A:
When Trace option is Enabled, the .trc file is created in Udump folder which is not in readable format. Tkprof utility is used to convert this .trc file into a readable format. syntax: tkprof trcfilename outputfilename
|
|
|
Q:
How do you set profile options from PL/SQL procedure?
|
|
A:
By calling the standard fnd_profile procedure.
|
|
|
Q:
Have you ever used TABLE datatype and what is it used for?
|
|
A:
TABLES are like Arrays, used for temporary storage. The declaration of TABLE involves 2 steps: Declare the table structure using TYPE statement and then declare the actual table.
|
|
|
Q:
What do you know about Trace and Tuning?
|
|
A:
No answer yet!
|
|
|
Q:
What is conditional filtering at database level? (Hint: New feature released in 10g)
|
|
A:
No answer yet!
|
|
|
Q:
How do you set the profile option in PL/SQL Procedure?
|
|
A:
No answer yet!
|
|
|
Q:
how to find out duplicate records from the table?
|
|
A:
No answer yet!
|
|
|
Q:
Can two users update the same row at the same time? if so how?
|
|
A:
No answer yet!
|
|
|
Q:
what is External table?
|
A:
External tables can be used to load flat files into the database. Steps: First create a directory say ext_dir and place the flat file (file.csv) in it and grant read/write access to it. Then create the table as below: create table erp_ext_table ( i Number, n Varchar2(20), m Varchar2(20) ) organization external ( type oracle_loader default directory ext_dir access parameters ( records delimited by newline fields terminated by , missing field values are null ) location (file.csv) ) reject limit unlimited;
|
|
|
Q:
What is global temporary table?
|
|
A:
Global temporary tables are session specific, meaning the users in other sessions cannot see or manipulate the data in the temporary table you have created. Only you can access or insert or delete or perform anything with the data in the temporary table in your session and the other users cannot use or access this. Once you end your session, the data in the temporary table will be purged.
|
|
|
Q:
How do you retrieve the last N records from a table?
|
A:
The RANK() and DENSE_RANK() functions can be used to determine the LAST N or BOTTOM N rows.
|
|