PL SQL What do you know about Trace and Tuning?

How do you set the profile option in PL/SQL Procedure? Have you ever used TABLE datatype and what is it used for? 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. How do you set profile options from PL/SQL procedure? By calling the standard fnd_profile procedure. what is External table? 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; Can two users update the same row at the same time? if so how? How do you retrieve the last N records from a table? The RANK() and DENSE_RANK() functions can be used to determine the LAST N or BOTTOM N rows. How do you eliminate duplicate rows from a table? How do you declare user defined Exception? Declare ... Excep_name exception; procedure Excep_name is begin raise some_exc; end Excep_name; Begin .... end; What is a mutating table? "UPDATE; CREATE TABLE ; ROLL BACK;" To which save point will the changes be Rolled Back? Updates done wouldn't be Rolled Back as CREATE statement which is a DDL would issue a COMMIT after the creation of the table. What is tkprof and the syntax?

weak type erp_cursor is ref cursor returning erp%rowtype. 11 open c1 for select * from scripts.log . In the case of Strong type. the . Tkprof utility is used to convert this . end. TRUNCATE is DDL command where as DELETE is DML command Can you use COMMIT in a trigger? Yes but by defining an autonomous transaction. syntax: tkprof trcfilename outputfilename How do you set the profile option from a PL/SQL procedure? What is the SQL statement used to display the text of a procedure stored in database? select text from dba_source where name = 'Procedurename' How do you retrieve the last N records from a table? Name the different database triggers? What is the difference between TRUNCATE and DELETE? TRUNCATE will completely erase the data where as in DELETE you have the option to delete only few rows. What is Ref Cursor? A ref cursor is a variable. defined as a cursor type.. 9 fetch c1 into r_c1. 6 7 begin 8 open c1 for select * from articles. 4 r_c1 articles%rowtype.. CREATE OR REPLACE TRIGGER trigger_name INSTEAD OF INSERT ON view name begin . Eg:type erp_cursor is ref cursor. 12 fetch c1 into r2_c1. Can triggers be used on views? If so How? Yes only INSTEAD OF trigger can be used to modify a view.When Trace option is Enabled. the data type of the returned cursor result is defined whereas in Weak type. Can you call a sequence in SQL Loader? Yes What are the three files that are generated when you load data using SQL Loader? . --strong declare 2 type erp_cursor is ref cursor. Ref Cursors are of 2 types: Weak and Strong.trc file is created in Udump folder which is not in readable format.trc file into a readable format. 13 close c1. which will point to a cursor result.bad . 5 r2_c1 scripts%rowtype. 3 c1 erp_cursor. -. 10 close c1. 14 end.discard . 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. it is not defined.

Function can be used in SQL statements and procedures can not. or even a PL/SQL block as a string and then execute it at runtime.SUBMIT_REQUEST() What is the difference between View and Materialized view? 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. a DELETE statement. END. Implicit Cursors. Ref Cursors . What are the different cursors available in PL/SQL ? Explicit Cursors. What is an autonomous transaction ? An autonomous transaction is an independent transaction that is initiated by another transaction (the parent transaction). How do you submit a concurrent program from PL/SQL Procedure? FND_REQUEST. An autonomous transaction can modify data and commit or rollback independent of the state of the parent transaction. What is dynamic SQL? Dynamic SQL allows you to construct a query.. Give the structure of the trigger? 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 .What are the types of Exceptions? System defined and user defined Exceptions What are the differences between Function and Procedure? Function has to return a value where procedure may or maynot return values. a CREATE TABLE statement. What is RAISE_APPLICATION_ERROR used for? 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..

. This can also be used to generate explain plan output. or. Database triggers do not fire on TRUNCATE What is ROWID? ROWID is a pseudo column attached to each row of a table. 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. What are SQLCODE and SQLERRM and why are they important for PL/SQL developers? SQLCODE returns the value of the error number for the last error encountered.e. .What is difference between TRUNCATE & DELETE TRUNCATE commits after deleting entire table i. They can be used in exception handling to report. the data in the temporary table will be purged. Once the trace file is generated you run the tkprof tool against the trace file and then look at the output from the tkprof tool. rownumber are the components of ROWID What are the advantages of VIEW? To protect some of the columns of a table from other users. store in an error log table. . What is global temporary table? Global temporary tables are session specific. how to find out duplicate records from the table? What is conditional filtering at database level? (Hint: New feature released in 10g) . What is tkprof and how is it used? The tkprof tool is a tuning tool used to determine cpu and execution times for SQL statements.To hide complexity of a query.To hide complexity of calculations. meaning the users in other sessions cannot see or manipulate the data in the temporary table you have created. blockno. These are especially useful for the WHEN OTHERS exception. cannot be rolled back. You use it by first setting timed_statistics to true in the initialization file and then turning on tracing for either the entire database via the sql_trace parameter or for the session using the ALTER SESSION command. Once you end your session. The SQLERRM returns the actual error message for the last error encountered. the error that occurred in the code. It is 18 characters long.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer: Get 4 months of Scribd and The New York Times for just $1.87 per week!

Master Your Semester with a Special Offer from Scribd & The New York Times