This action might not be possible to undo. Are you sure you want to continue?
What is difference between a PROCEDURE & FUNCTION ?
A function can be called from sql statements and queries while procedure can be called in a begin end block only. In case of function, only it takes IN parameters, IN case of procedure take IN,OUT,INOUT parameters.. In case of function,it must have return type. In case of procedure,it may or may not have return type. We can use DDL in Procedure using Execute Immediate statement while that is not possible in functions
Difference between implicit and explicit cursor's. ? rowid and rownum
No Need to declare implicit cursors, oracle creates, process and closes automatically. In explicit cursor it should be declared and closed by the user.
Every record in a database is uniquely identified by system generated value called Rowid. It Is a 18 character hexma decimal value. These Rowid's are physically existence. It is a pseduocolumn which generates the sequence of numeric values based on the position of the records in the output. These ROWNUM'S logically generated.
Advantage and disadvantage of Cursor?
Cursors are used for storing, managing and retrieving data. Each time we fetch a row from the cursor, it result a network round trip, where as a normal select statement query make only one round trip.
How we can create a table in PL/SQL block. insert records into it???
l_stmt VARCHAR2(200); BEGIN l_stmt := 'create table '|| p_table_name || ' as (select * from emp )'; execute IMMEDIATE l_stmt; END;
Name the tables where characteristics of Package, procedure and functions are stored ?
User_objects, User_Source and User_error.
How to debug the procedure ?
put a dbms output_putline statement which will display that your procedure is executing successfully up to which stage.
What is pl/sql? what are the advantages of pl/sql? In SQL we can manipulate the data. Otherwise deadlock situation occur as a result we will get a error in the transaction. Before insert on STATEMENT LEVEL TRIGGER 4. Before insert on ROW LEVEL TRIGGER 2. e. 1.Savepoint be used in Database Triggers?If yes than HOW? If no Why?With Reasons No.its an extension of SQL used to manipulate as well as process the data. After insert on STATEMENT LEVEL TRIGGER 5. Explain how procedures and functions are called in a PL/SQL block ? Function can be called from SQL query + explicitly as well e. Before update on ROW LEVEL TRIGGER 6.fn_comm(salary)from employee. 2)commision=fn_comm(salary).g 1)select empno. 11. Begin ( proc_comm(salary).g. 9. we can't process data through Sql command for doing that we need a programming language such as PL/SQL . After update on STATEMENT LEVEL TRIGGER. There are 14 types of DML TRIGGER But we can fire only 12 types of triggers. ) end . 8. 10 After Delete on STATEMENT LEVEL TRIGGER.salary. After update on ROW LEVEL TRIGGER 7. Before update on STATEMENT LEVEL TRIGGER.Rollback . Before Delete on ROW LEVEL TRIGGER. Once trigger execution is complete then only a transaction can be said as complete and then only commit should take place. AFTER insert on ROW LEVEL TRIGGER 3. Procedure can be called from begin-end clause. 1. 12 After Delete on ROW LEVEL TRIGGER Can Commit. because remaining 2 types of triggers fire on View. Before Delete on STATEMENT LEVEL TRIGGER.
With out parameters you can get the more than one out values in the calling program. It is recommended not to use out parameters in functions. END. How to avoid using cursors? What to use instead of cursor and in what cases to do so? loop dbms_output. . / ? ROWTYPE and TYPE RECORD ? % ROWTYPE is to be used whenever query returns a entire row of a table or view. TYPE rec RECORD is to be used whenever query returns columns of different table or views and variables.ename emp ename %type ). e_rec emp% ROWTYPE cursor c1 is select empno.empno). all changed data will be saved in permenent database. e_rec c1 %ROWTYPE.empno% type.put_line(emprec. How to disable multiple triggers of a table at at a time? ALTER TABLE<TABLE NAME> DISABLE ALL TRIGGER In pl/sql functions what is use of out parameter even though we have return statement. If you need more than one out values then use procedures instead of functions.close occurs When the number of rows returned by query is small (around 100) then explicit cursor can be avoided for emprec in (select * from emp) How we can create a table through procedure ? create procedure p1 is begin EXECUTE IMMEDIATE 'CREATE TABLE temp AS SELECT * FROM emp ' .g. end loop. After commit all the locks on the database tables are leased.fetch. TYPE r_emp is RECORD (eno emp. no exit statement needed implicit open. E.deptno from emp.What will happen after commit statement ? After commit statement.
'manager is not a valid employee').one query is independent of 2 nd query so of course we can run. The columns that compose PK are automatically define NOT NULL.Difference %TYPE and %ROWTYPE ? %ROWTYPE allows us to assign a variable with an entire table row.sal<=b. Invalid_Cursor Too_many_rows. Others What is Raise_application_error ? The RAISE_APPLICATION_ERROR is a procedure defined by Oracle that allows the developer to raise an exception and associate an error number and message with the procedure other than just Oracle errors. EXCEPTION when NO_DATA_FOUND then RAISE_APPLICATION_ERROR(-20201.sal).sal) FROM EMP A WHERE 3 = (SELECT COUNT (DISTINCT (b. Value_Error. ? UNIQUE and PRIMARY KEY constraints? A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. Difference Between oracle 9i and 10G 1) 2) 3) 4) 5) faster data movement with expdp and impdp Dbms_scheduler package replaces dbms_job for scheduling Ability to rename tablespaces Passwords for db links are encrypted ASM Automated storing manager 3rd Highest salary from emp table ? SELECT DISTINCT (a. Any three PL/SQL Exceptions? PL/SQL Cursor Exceptions? Cursor_Already_Open. Oracle Installed version information ? select banner from v$version. The %TYPE assign a variable with a single column type.sal)) FROM EMP B WHERE a. whereas a column that compose a UNIQUE is not automatically defined to be mandatory must also specify the column is NOT NULL. . No_Data_Found. Zero_Error. In a Distributed Database System Can we execute two queries simultaneously ? Justify ? As Distributed database system based on 2 phase commit.
Change Oracle password? 1) Alter user custom identified by ranjeet. select TOP 9 rows from a table? SELECT * FROM (SELECT * FROM cmg ORDER BY cust_id DESC) WHERE ROWNUM < 10. CREATE SEQUENCE cmg_seq_name START WITH 1 INCREMENT BY 1. SELECT ename.NEXTVAL. Retrieve 12th row from a table? SELECT * FROM ( SELECT ENAME. Drop a column from a table? ALTER TABLE cmg DROP COLUMN cust_id.ROWNUM RN FROM EMP WHERE ROWNUM < 101) WHERE RN between 91 and 100.Escape special characters when building SQL queries? SELECT name FROM emp WHERE id LIKE '%\_%' ESCAPE ' Generate primary key values for a table? UPDATE cmg SET seqno = ROWNUM. UPDATE cmg SET seqno = cmg_seq_name. CASE WHEN sal>1000 THEN 'Over paid' ELSE 'Under paid' END FROM emp. ? Indexing ? ? Query ? Indexing is a technique for determining how quickly specific data can be found. CASE statements in SQL. The query language can be classified into data . Retrieve Rows from 90 to 100 SELECT * FROM (SELECT ENAME. Query is the commands used to communicate with data base.ROWNUM RN FROM EMP WHERE ROWNUM < 13 ) WHERE RN = 12. 2) password. Add a column in a table? alter cmg t1 add ( customer varchar2(16) ). 3) password migr. SELECT * FROM tableX WHERE rowid in (SELECT rowid FROM tableX WHERE rownum <= 7 MINUS SELECT rowid FROM tableX WHERE rownum < 5).
STATUS USER_OBJECTS LAST_DDL_TIME > '&CHECK_FROM_DATE'. ? Correlated subquery ? Query that is executed for every row of the parent is correlated subquery. NULL. ? Stored-procedures? Advantages ?.definition language and data manipulation language. Enables in the declarations area of subprogram specifications. ? Exceptions handled in PL/SQL? Some Internal exceptions ? If any Error occurs. 'CONNECT'. Copy data from one database to another in SQL*Plus? COPY FROM SCOTT/TIGER@LOCAL_DB TO SCOTT/TIGER@REMOTE_DB Check if somebody modified any code? SELECT OBJECT_NAME. It reduce network traffic ? Normalization ? It is a process of analysing the given relation schemas based on their Functional Dependencies (FDs) and primary key to achieve the properties Minimizing redundancy Minimizing insertion.PRODUCT_USER_PROFILE VALUES ('SQL*Plus'. deletion and update anomalies. NULL. FROM WHERE . TO_CHAR(LAST_DDL_TIME. And it is used to bring back a set of rows to be used by the parent query. There is an exception named OTHERS that catch all other exceptions which is not defined internally/user defined Disable all users whose names starts with OPS$ ? INSERT INTO SYSTEM. 'DISABLED'. update. 'DD-Mon-RR HH24:MI') MOD_TIME. Nt:. and delete statements against a table. NULL). than exception handler allows to continue further execution. It is a set of SQL Statements that perform a user defined operation and returns the result to the client. TO_CHAR(CREATED. NULL. 'OPS$%'. if no critical issue that can terminate the process.Columns from the subquery cannot be referenced anywhere else in the parent query ? Trigger? It is an PL/SQL block that can be created to automatically execute for insert.'DD-Mon-RR HH24:MI') CREATE_TIME.
line user_source UPPER(text) LIKE '%&KEYWORD%'. SELECT * FROM EMP ORDER BY ENAME DESC ? CASCADE CONSTRAINTS? Is used with the DROP command. ? DESC in SQL? Describe schema and select rows from table in descending order. to drop a parent table even when a child table exists. delete. DELETE can be rolled back. In Where clause we have to write FALSE condition CREATE TABLE NEWTABLE AS SELECT * FROM EXISTINGTABLE WHERE 1=2. all System tables contain details on privileges granted and obtained? USER_TAB_PRIVS_MADE USER_TAB_PRIVS_RECD System table contains details on constraints on all the tables ? USER_CONSTRAINTS ? TRUNCATE and DELETE ? TRUNCATE is DDL command and DELETE is DML. We can use WHERE in delete Copy only Table structure.sql oname=xxxx. index. references. . select.plb ORACLE_HOME/bin Privileges granted on table by a user to others? Insert. Protect PL/SQL source code? wrap iname=myscript.Search PL/SQL code for a string/ key value ? SELECT FROM WHERE type. execute. update. name. alter.
Describe what redo logs are. Database link dropped. When a user process fails. How would you determine who has added a row to a table? Turn on fine grain auditing for the table. 38. How would you determine what sessions are connected and what resources they are waiting for? Use of V$SESSION and V$SESSION_WAIT 32. 33. How would you force a log switch? ALTER SYSTEM SWITCH LOGFILE. create public database link GBMTOFINACLE connect to GBM identified by gbm using 'GBMMIG1'.ORA ============ DB_LINK====================== drop public database link GBMTOFINACLE. Name two files used for network connection to a database. 44. How can you gather statistics on a table? The ANALYZE command. 43. Redo logs are logical and physical structures that are designed to hold all the changes made to a database and are intended to aid in the recovery of a database.DBA 29. what background process cleans up after it? PMON 31.ORA and SQLNET.SET_SQL_TRACE or Use ALTER SESSION SET SQL_TRACE = TRUE. TNSNAMES. what permissions must you grant to allow them to connect to the database? Grant the CONNECT to the user. When creating a user. ============ DB_LINK====================== . 50. 47. How can you enable a trace for a session? Use the DBMS_SESSION. 37. How can you rebuild an index? ALTER INDEX <index_name> REBUILD. Name a tablespace automatically created when you create a database. The SYSTEM tablespace. 48.
This action might not be possible to undo. Are you sure you want to continue?
We've moved you to where you read on your other device.
Get the full title to continue reading from where you left off, or restart the preview.