Top MNC'S Interview questions and answers

39
1. Introduce yourself 2. Difference between having and group by HAVING is only for conditions involving aggregates used in conjunction with the GROUP BY clause. eg. COUNT, SUM, AVG, MAX, MIN. WHERE is for any non-aggregage conditions. They can even be used together in the same query . SELECT t1.id, COUNT (*) FROM table1 AS t1 INNER JOIN table2 AS t2 ON t2.t1_id = t1.id WHERE t1.score > 50 GROUP BY t1.id HAVING COUNT (*) > 2; 3. What is IN parameter and OUT parameter in PLSQL? 1. IN - The parameter can be referenced by the procedure or function. The value of the parameter can not be overwritten by the procedure or function. 2. OUT - The parameter cannot be referenced by the procedure or function, but the value of the parameter can be overwritten by the procedure or function. 3. IN OUT - The parameter can be referenced by the procedure or function and the value of the parameter can be overwritten by the procedure or function. 4. Difference between Value sets and Lookups Value sets and Lookups might look similar and confuse some people but there are some basic differences between the two. Value Sets Loo kups Value sets can be attached to parameters of a concurrent program. Lookups can n’t be attached to parameters of a concurrent program. Value Sets are almost never maintained by end users, with the exception of GL Lookups are maintainable by the users.

Transcript of Top MNC'S Interview questions and answers

Page 1: Top MNC'S Interview questions and answers

1. Introduce yourself

2. Difference between having and group by

HAVING is only for conditions involving aggregates used in conjunction with the GROUP BY clause. eg. COUNT, SUM, AVG, MAX, MIN. WHERE is for any non-aggregage conditions. They can even be used together in the same query

. SELECT t1.id, COUNT (*) FROM table1 AS t1

INNER JOIN table2 AS t2 ON t2.t1_id = t1.id

WHERE t1.score > 50

GROUP BY t1.id HAVING COUNT (*) > 2;

3. What is IN parameter and OUT parameter in PLSQL?

1. IN - The parameter can be referenced by the procedure or function. The value of the parameter can not be overwritten by the procedure or function. 2. OUT - The parameter cannot be referenced by the procedure or function, but the value of the parameter can be overwritten by the procedure or function.

3. IN OUT - The parameter can be referenced by the procedure or function and the value of the parameter can be overwritten by the procedure or function.

4. Difference between Value sets and Lookups

Value sets and Lookups might look similar and confuse some people but there are some basic differences between the two.

Value Sets LookupsValue sets can be attached to parameters of a concurrent program.

Lookups can n’t be attached to parameters of a concurrent program.

Value Sets are almost never maintained by end users, with the exception of GL Flex field codes. Lookups are maintainable by the users.Value sets are usually maintained by System Administrators.

HR Users will maintain "Ethnic Minority" lookups.

Value sets can contain values that are a result of an SQL Statement. Hence it is possible to make Value Set list of values dynamic.

Page 2: Top MNC'S Interview questions and answers

5. How we can eliminate duplicates without using distinct command?

DELETE FROM emp WHERE rowid IN(SELECT eno,ename,sal,max(rowid) FROM emp GROUP BY eno,ename,sal);

6. How to retrieve a second highest salary from a table?

Select Max(Salary) from Emp Where Salary < (Select Max(Salary) from Emp).

7. Difference between case and decode

DECODE is Oracle standard and CASE is ANSI standard

Both CASE and DECODE can be used in WHERE clause.

CASE can be directly used in PL/SQL but DECODE can be used in PL/SQL through SQL statements only.

Case cannot process null while decode can.

8. The two different types of Exceptions in PL/SQL are: ?

User Defined

Pre-Defined

9. Cursor attributes:

There are five cursor attributes:

%isopen

%found

%notfound

%rowcount

%bulk_rowcount

10. What is %TYPE and %ROWTYPE in PL/SQL??

%TYPE provides the data type of a variable or a database column to that variable. %ROWTYPE provides the record type that represents a entire row of a table or view or columns selected in the cursor.

Page 3: Top MNC'S Interview questions and answers

Ex:- DECLARE  l_rec employee%rowtype;  CURSOR c1  IS    SELECT * FROM employee WHERE empno = 100;BEGIN  OPEN c1;  FETCH c1 INTO l_rec;  CLOSE c1;END;

11. List all different types of Data Types in PL/SQL?

Here are the complete lists of Data Types supported by OracleNumber Data Types

BINARY_INTEGER

NUMBER(p,s)

NATURAL

NATURALN

PLS_INTERGER

POSITIVE

POSITIVEN

SIGNTYPE

NUMERIC(p,s)

FLOAT

DEC(p,s)

DECIMAL(p,s)

INTEGER

INT

SMALLINT

REAL

DOUBLE PRECISION

Page 4: Top MNC'S Interview questions and answers

 12.Types of Report Triggers:-

a) Report Trigger: Order of Execution of Report Trigger is,· Before Parameter form trigger is fired· After Parameter form trigger is fired· Before Report Trigger is fired· Between pages fires for each page except last one· After Report trigger is fired

13.What is difference between a PROCEDURE & a FUNCTION ?

Function is mainly used in the case where it must return a value. Where as a procedure may or may not return a value or may return more than one value using the OUT parameter.

14. What is difference between % ROWTYPE and TYPE RECORD?

Advantages:% 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.

Example:TYPE r_emp IS RECORD (eno emp.empno% type,ename emp ename %type);e_rec emp% ROWTYPEcursor c1 is SELECT empno,deptno FROM emp;e_rec c1 %ROWTYPE.

15. Can you have multiple layout templates for a singe data template?

Yes! Multiple layouts can be attached, so that user will have a choice here to use one among them at the time of concurrent program submission

DECODE is a function where CASE is a Expression.

16. What is bursting in XML Publisher?

What are the different ways to show/insert an image on XMLP layout?

There are 4 different ways to insert/show an image in rtf:

Insert an image directly on rtf just by using MS word standard feature

Using OA_MEDIA: storing on server and giving physical path of the image

Using URL of a image hosted on some website

Page 5: Top MNC'S Interview questions and answers

Retrieving the image store in a database as BLOB type

17. Difference between delete and truncate

You cann't rollback in TRUNCATE but in DELETE you can rollback. TRUNCATE removes the record permanently.

In case of TRUNCATE, Trigger doesn't get fired. But in DML commands like DELETE Trigger get fired.

You cann't use conditions(WHERE clause) in TRUNCATE.But in DELETE you can write conditions using WHERE clause

18. How many types of indexes

We have mainly two different indexes.

Implicit index and explicit index.

Explicit indexes are again of many types likesimple index, unique index, Bitmap index, Functional index, Organisational index, cluster index.

19. What is trigger? How many types of Trigger are there?

Trigger is a procedure th gets implicitly executed when an insert/update/delete statement is issued against an associated

table. Triggers can only be defined on tables not no views , however triggers on the base table of a view are fired if an

..0Insert/update/delete statement is issued against a view . there are two types of triggers stament level and Row level trigger

Insert

After /For each row

Trigger is fire /update/Befor/for each statement delete

20. Diff b/w view and materialized view

Materialized view is physical duplicate data in a table view is logical representation of table

Page 6: Top MNC'S Interview questions and answers

21. Can we update the view

Suppose you want update view means that time you need to use insted of trigger with that only possible to update view

22. I have one table i created view and materialized view on a table if i delete a table, Can i see the view and materialized view?

23. Can u call function in same function

Yes

24.Can we use tcl commands in trigger

Nope, you cannot.

25. What is the cursor and ref cursor

Generally ref cursor used for passing cursor parameter and also dynamically building the query.

Normal cursor are static cursors and also we can't able to pass like parameters

26. What is the purpose of Token in Concurrent Program Definition form?

Token is used for transferring values towards report builder. Tokens are usually not case – sensitive.

27. Formula column

We use formula column to calculate some information dynamically using information based on the columns of the data model or from the concurrent program parameters. It is basically used to apply some custom logic on input data and return some value.

Formula columns can be written using PL/SQL syntax and we can use pl/sql functions for computation on the data. Formula column will accept data of Character, Number, or Date type.

Ex:- CF_

28. Summary column :-

Summary columns are used for calculating summary information like sum, average etc,. on specific columns of a data group. This column uses a set of predefined oracle aggregate

Page 7: Top MNC'S Interview questions and answers

functions. Summary columns are generally preceded by CS_ to distinguish them from other columns.

29. To fetch ALTERNATE records from a table. (EVEN NUMBERED)

select * from emp where rowid in (select decode(mod(rownum,2),0,rowid, null) from emp);

30. To select ALTERNATE records from a table. (ODD NUMBERED)

select * from emp where rowid in (select decode(mod(rownum,2),0,null ,rowid) from emp);

31. Find the 3rd MAX salary in the emp table.

select distinct sal from emp e1 where 3 = (select count(distinct sal) from emp e2 where e1.sal <= e2.sal);

32. Find the 3rd MIN salary in the emp table.

select distinct sal from emp e1 where 3 = (select count(distinct sal) from emp e2where e1.sal >= e2.sal);

33. Select FIRST n records from a table.

select * from emp where rownum <= &n;

34. Select LAST n records from a table

select * from emp minus select * from emp where rownum <= (select count(*) - &n from emp);

35. List dept no., Dept name for all the departments in which there are no employees in the department.

select * from dept where deptno not in (select deptno from emp);

alternate solution: select * from dept a where not exists (select * from emp b where a.deptno = b.deptno);

altertnate solution: select empno,ename,b.deptno,dname from emp a, dept b where a.deptno(+) = b.deptno and empno is null;

36. How to get 3 Max salaries ?

select distinct sal from emp a where 3 >= (select count(distinct sal) from emp b where a.sal <= b.sal) order by a.sal desc;

Page 8: Top MNC'S Interview questions and answers

37. How to get 3 Min salaries ?

select distinct sal from emp a where 3 >= (select count(distinct sal) from emp b where a.sal >= b.sal);

38. How to get nth max salaries ?

select distinct hiredate from emp a where &n = (select count(distinct sal) from emp b where a.sal >= b.sal);

39. Select DISTINCT RECORDS from emp table.

select * from emp a where rowid = (select max(rowid) from emp b where a.empno=b.empno);

40. How to delete duplicate rows in a table?

delete from emp a where rowid != (select max(rowid) from emp b where a.empno=b.empno);

41. Count of number of employees in department wise.

select count(EMPNO), b.deptno, dname from emp a, dept b where a.deptno(+)=b.deptno group by b.deptno,dname;

42. Suppose there is annual salary information provided by emp table. How to fetch monthly salary of each and every employee?

select ename,sal/12 as monthlysal from emp;

43. Select all record from emp table where deptno =10 or 40.

select * from emp where deptno=30 or deptno=10;

44. Select all record from emp table where deptno=30 and sal>1500.

select * from emp where deptno=30 and sal>1500;

45. Select all record from emp where job not in SALESMAN or CLERK.

select * from emp where job not in ('SALESMAN','CLERK');

Page 9: Top MNC'S Interview questions and answers

46. Select all record from emp where ename in 'BLAKE','SCOTT','KING'and'FORD'.

select * from emp where ename in('JONES','BLAKE','SCOTT','KING','FORD');

47. Select all records where ename starts with ‘S’ and its lenth is 6 char.

select * from emp where ename like'S____';

48. Select all records where ename may be any no of character but it should end with ‘R’.

select * from emp where ename like'%R';

49. Count MGR and their salary in emp table.

select count(MGR),count(sal) from emp;

50. In emp table add comm+sal as total sal .

select ename,(sal+nvl(comm,0)) as totalsal from emp;

51. Select any salary <3000 from emp table.

select * from emp where sal> any(select sal from emp where sal<3000);

52. Select all salary <3000 from emp table.

select * from emp where sal> all(select sal from emp where sal<3000);

53. Select all the employee group by deptno and sal in descending order.

select ename,deptno,sal from emp order by deptno,sal desc;

Page 10: Top MNC'S Interview questions and answers

54. How can I create an empty table emp1 with same structure as emp?

Create table emp1 as select * from emp where 1=2;

55. How to retrive record where sal between 1000 to 2000?

Select * from emp where sal>=1000 And sal<2000

56. Select all records where dept no of both emp and dept table matches.

select * from emp where exists(select * from dept where emp.deptno=dept.deptno)

57. If there are two tables emp1 and emp2, and both have common record. How can I fetch all the recods but common records only once?

(Select * from emp) Union (Select * from emp1)

58. How to fetch only common records from two tables emp and emp1?

(Select * from emp) Intersect (Select * from emp1)

59. How can I retrive all records of emp1 those should not present in emp2?

(Select * from emp) Minus (Select * from emp1)

60. Count the totalsa deptno wise where more than 2 employees exist.

SELECT deptno, sum(sal) As totalsal

FROM emp

GROUP BY deptno

HAVING COUNT(empno) > 2

60. How can a break order be created on a column in an existing group?

By dragging the column outside the group

61. What are the types of calculated columns available?

Page 11: Top MNC'S Interview questions and answers

Summary, Formula, Placeholder column.

62. What is the use of place holder column?

A placeholder column is used to hold a calculated values at a specified place rather than allowing is to appear in the actual row where it has to appeared.

63. What is the use of hidden column?

A hidden column is used to when a column has to embed into boilerplate text.

64. What is the use of break group?

A break group is used to display one record for one group ones. While multiple related records in other group can be displayed.

67. If two groups are not linked in the data model editor, what is the hierarchy between them?

Two group that is above are the left most rank higher than the group that is to right or below it.

68. The join defined by the default data link is an outer join yes or no?

Yes.

69. How can a text file be attached to a report while creating in the report writer?

By using the link file property in the layout boiler plate property sheet.

70. Can a repeating frame be created without a data group as a base?

No.

71. Can a field be used in a report without it appearing in any data group?

Yes.

72. For a field in a repeating frame, can the source come from the column which does not exist in the data group which forms the base for the frame?

Yes.

73. Is it possible to centre an object horizontally in a repeating frame that has a variable horizontal size?

Yes.

74. If yes, how?

Page 12: Top MNC'S Interview questions and answers

By the use anchors.

75. What are the two repeating frame always associated with matrix object?

One down repeating frame below one across repeating frame.

76. Is it possible to split the print previewer into more than one region?

Yes.

77. Does a grouping done for objects in the layout editor affect the grouping done in the data model editor?

No.

78. How can a square be drawn in the layout editor of the report writer?

By using the rectangle tool while pressing the (Constraint) key.

79. To display the page no. for each page on a report what would be the source & logical page no. or & of physical page no.?

& physical page no.

80. What does the term panel refer to with regard to pages?

A panel is the no. of physical pages needed to print one logical page.

81. What is an anchoring object & what is its use?

An anchoring object is a print condition object which used to explicitly or implicitly anchor other objects to itself.

82. What is a physical page? & what is a logical page?

A physical page is a size of a page. That is output by the printer. The logical page is the size of one page of the actual report as seen in the Previewer.

83. What is the frame & repeating frame?

A frame is a holder for a group of fields. A repeating frame is used to display a set of records when the no. of records that are to displayed is not known before.

84. What is SQLCODE and SQLERRM in PL/SQL?

The SQLCODE function returns the error number associated with the most recently raised error exception. This function should only be used within the Exception Handling section of your code.

Page 13: Top MNC'S Interview questions and answers

The SQLERRM function returns the error message associated with the most recently raised error exception. This function should only be used within the Exception Handling section of your code.

IBM PLSQL Interview Question

Can we use where condition with truncate?

No, TRUNCATE is all or nothing. You can do a DELETE FROM <table> WHERE <conditions> but this loses the speed advantages of TRUNCATE.

Can you explain the truncate and delete with trigger?

DELETEDelete is the command that only remove the data from the table. It is DML statement. Deleted data can be rollback. By using this we can delete whole data from the table(if use without where clause). If you want to remove only selected data then we should specify condition in the where clausedelete from employee ;( this command will remove all the data from table)delete from employee where employee name='JOHN';(This command will remove only that row from employee table where employee_name is JOHN');

DROP:Drop command remove the table from data dictionary. This is the DDL statement. We can not recover the table before Oracle 10g. But Oracle 10g provide the command to recover it by using the command (FLASHBACK)

TRUNCATE:This is the DML command. This command delete the data from table. But there is one difference from ordinary delete command. Truncate command drop the storage held by this table. Drop storage can be used by this table again or some other table. This is the faster command because it directly drop the storage

4>In case of TRUNCATE, Trigger doesn't get fired. But in DML commands like DELETE .Trigger get fired.

5>you cann't use conditions (WHERE clause) in TRUNCATE. But in DELETE you can write conditions using WHERE clause

Can we use truncate and delete command to disable the referential integrity constraint?

Page 14: Top MNC'S Interview questions and answers

> First time asker, long time reader! My question:

I wish to delete all records from a parent table and all records from a child table.

If I delete from from the child table then delete from the parent,

Everything works fine. But if I truncate the child table, then try to

truncate the parent, I get an error:

> ERROR at line 1:

> ORA-02266: unique/primary keys in table referenced by enabled foreign keys

> Do you have insight into this?

Differences between the DELETE command and the TRUNCATE command.

DELETE removes one or more records in a table, checking referential

Constraints (to see if there are dependent child records) and firing any

DELETE triggers. In the order you are deleting (child first then parent)

There will be no problems.

TRUNCATE removes ALL records in a table. It does not execute any triggers.

Also, it only checks for the existence (and status) of another foreign key

Pointing to the table. If one exists and is enabled, then you will get

Your error. This is true even if you do the child tables first.

You should disable the foreign key constraints in the child tables before

Issuing the TRUNCATE command, then re-enable them afterwards.

Page 15: Top MNC'S Interview questions and answers

How did you export the data from database to excel file?

How many types of functions in UTL_FILE package?

With the Oracle-supplied UTL_FILE package, you can read from and write to operating system files. It Provides security for directories on the through the init. Ora file. UTL_FILE Procedures and Functions:• Function FOPEN• Function IS_OPEN• Procedure GET_LINE• Procedure PUT, PUT_LINE, PUTF• Procedure NEW_LINE• Procedure FFLUSH• Procedure FCLOSE, FCLOSE_ALL

What function you are using to load the data in UTL_FILE package?

Introduced in Oracle 7.3, UTL_FILE PL/SQL package provides a functionality of reading and writing text file into operating system files. That means you can load external data from other source to database or can generate report from your PL/SQL code and write to text file on operating system.

UTL_FILE package provides access to text file on the OS of the database server. You can use

one of the following approaches to restrict access to text file from database server.

Use the UTL_FILE_DIR parameter in init.ora initialization file to specify the accessible directory for the UTL_FILE functions to read or write operation

UTL_FILE_DIR ='E:\app\madhurendra\wr_file' Use the CREATE DIRECTORY statement [ORACLE 9i or above]to associate an

operating system directory with alias to provide read/write operation CREATE DIRECTORY my_demo_dir AS 'E:\app\madhurendra\wr_file'; GRANT READ, WRITE ON DIRECTORY my_demo_dir TO user$plsql;

Followings are some procedures, functions and exceptions of the UTL_FILE package.DATA TYPEFILE_TYPE Data type for a file-handlePROCEDURES & FUCTIONSIS_OPEN Checks whether file is open or not. Returns TRUE if open and FALSE if close.FOPEN Opens a file for read or write.FCLOSE Closes an open fileFCLOSE_ALL Closes all open file for the current sessionNEW_LINE Insert a new line terminator to a filePUT_LINE Write strings of text followed by a new line terminatorPUT Same as PUT_LINE but don’t place a new line terminator.PUTF Writes formatted text into fileGET_LINE Read a line from file. The maximum outputFFLUSH Writes all the buffered data into fileEXCEPTIONSINVALID_PATH File location is not valid

Page 16: Top MNC'S Interview questions and answers

INVALID_MODE OPEN_FILE mode is not valid. [Specific to FOPEN]INVALID_FILENAME Filename is not validREAD_ERROR Operating system error occurred during the read operation.WRITE_ERROR Operating system error occurred during the write operation.FILE_OPEN Operation failed because the file is already open.These exceptions must be prefixed with UTL_FILE. Apart from that UTL_FILE can also raise pre-defined exceptions like NO_DATA_FOUND and VALUE_ERROR.Followings are a couple of very simple example of UTL_FILE package:In the following anonymous block, data is written by UTL_FILE package to a text file ‘my_f_file.txt’.

DECLARE v_file UTL_FILE.FILE_TYPE;BEGIN v_file := UTL_FILE.FOPEN('MY_DEMO_DIR', 'my_f_file.txt', 'w'); UTL_FILE.PUT_LINE(v_file, 'Hello World!'); UTL_FILE.PUT_LINE(v_file, 'I stared using UTL_FILE'); UTL_FILE.FCLOSE(v_file);END;

How many types of trigger?

BEFORE UPDATE, Statement Level BEFORE UPDATE, Row Level AFTER UPDATE, Statement LevelAFTER UPDATE, Row Level

How many max triggers you will declare what is instead of trigger?

You can create N numbers of triggers on a table but the maximum possible types trigger can be applied is 3*2*2=12

(Insert/Update/Delete= 3, before/after= 2, Row Level/Statement Level=2)

What is implicit and explicit cursor?

PL/SQL declares a cursor implicitly for all SQL data manipulation statements, including quries that return only one row. However, queries that return more than one row you must declare an explicit cursor or use a cursor FOR loop.Explicit cursor is a cursor in which the cursor name is explicitly assigned to a SELECT statement via the CURSOR...IS statement. An implicit cursor is used for all SQL statements Declare, Open, Fetch, Close. An explicit cursors are used to process multi row SELECT statements An implicit cursor is used to process INSERT, UPDATE, DELETE and single row SELECT. .INTO statements.

Page 17: Top MNC'S Interview questions and answers

What is exception?

PL/SQL provides a feature to handle the Exceptions which occur in a PL/SQL Block known as exception Handling. Using Exception Handling we can test the code and avoid it from exiting abruptly.When an exception occurs messages which explains its cause is received. PL/SQL Exception message consists of three parts. 1) Type of Exception2) An Error Code3) A message

How many types of exception Can we have more than one exception?

Types of Exception.There are 3 types of Exceptions. a) Named System Exceptions b) Unnamed System Exceptions c) User-defined Exceptions

DECLARE --<Declaration section >BEGIN --<logic>EXCEPTION WHEN ex_name1 THEN -Error handling statements WHEN ex_name2 THEN -Error handling statements WHEN Others THEN -Error handling statements END;

What are predefined exceptions?

PL/SQL provides many pre-defined exceptions, which are executed when any database rule is violated by a program. For example, the predefined exception NO_DATA_FOUND is raised when a SELECT INTO statement returns no rows. The following table lists few of the important pre-defined exceptions:

Exception Oracle Error

SQLCODE Description

ACCESS_INTO_NULL 06530 -6530 It is raised when a null object is automatically assigned a value.

Page 18: Top MNC'S Interview questions and answers

CASE_NOT_FOUND 06592 -6592 It is raised when none of the choices in the WHEN clauses of a CASE statement is selected, and there is no ELSE clause.

COLLECTION_IS_NULL 06531 -6531 It is raised when a program attempts to apply collection methods other than EXISTS to an uninitialized nested table or varray, or the program attempts to assign values to the elements of an uninitialized nested table or varray.

DUP_VAL_ON_INDEX 00001 -1 It is raised when duplicate values are attempted to be stored in a column with unique index.

INVALID_CURSOR 01001 -1001 It is raised when attempts are made to make a cursor operation that is not allowed, such as closing an unopened cursor.

INVALID_NUMBER 01722 -1722 It is raised when the conversion of a character string into a number fails because the string does not represent a valid number.

LOGIN_DENIED 01017 -1017 It is raised when s program attempts to log on to the database with an invalid username or password.

NO_DATA_FOUND 01403 +100 It is raised when a SELECT INTO statement returns no rows.

NOT_LOGGED_ON 01012 -1012 It is raised when a database call is issued without being connected to the database.

PROGRAM_ERROR 06501 -6501 It is raised when PL/SQL has an internal problem.

ROWTYPE_MISMATCH 06504 -6504 It is raised when a cursor fetches value in a variable having incompatible data type.

Page 19: Top MNC'S Interview questions and answers

SELF_IS_NULL 30625 -30625 It is raised when a member method is invoked, but the instance of the object type was not initialized.

STORAGE_ERROR 06500 -6500 It is raised when PL/SQL ran out of memory or memory was corrupted.

TOO_MANY_ROWS 01422 -1422 It is raised when s SELECT INTO statement returns more than one row.

VALUE_ERROR 06502 -6502 It is raised when an arithmetic, conversion, truncation, or size-constraint error occurs.

ZERO_DIVIDE 01476 1476 It is raised when an attempt is made to divide a number by zero.

Do you know TOO_MANY ROWS, when that exception will occur and NO_DATA FOUND How to catch any type of exception?

DECLARE v_drop_partition VARCHAR2(1) := NULL;BEGIN SELECT drop_partition INTO v_drop_partition FROM xxx.part_maint WHERE drop_partition = 'Y' ; FOR prec IN (SELECT * FROM xxx.part_maint WHERE drop_partition = 'Y' ) LOOP DBMS_OUTPUT.PUT_LINE (prec.SCHEMA_NAME || ' ' || prec.OBJECT_NAME); END LOOP;EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE ('hello');END;

Can we commit in trigger?

Page 20: Top MNC'S Interview questions and answers

Yes, You can Commit inside the trigger.But for this you have to make this trigger transaction to be a Independent transaction from its parent transaction, You can do this by using Pragma. Pragma AUTONOMOUS_TRANSACTION allow you to build the Independent(child) Transaction, started by another. Shold be declare in DECLARE section of any subprogram.Used to make Modular and Reusable Blocks. if you need the example then ask to me.

CREATE OR REPLACE TRIGGER triggerAFTER INSERT ON t1 FOR EACH ROW

DECLARE PRAGMA AUTONOMOUS_TRANSACTION; i PLS_INTEGER; BEGIN SELECT COUNT(*) INTO i FROM t1;

INSERT INTO t2 VALUES (i); COMMIT;END;

What is autonomous transaction?

An autonomous transaction is an independent transaction to the main or parent transaction. If an Autonomous transaction is started by another transaction it is not nested, but independent of parent transaction.

CREATE OR REPLACE PROCEDURE child block IS

BEGIN INSERT INTO t

Page 21: Top MNC'S Interview questions and answers

(test value) VALUES ('Child block insert'); COMMIT; END child_block;

What is view?

An Oracle VIEW, in essence, is a virtual table that does not physically exist. Rather, it is created by a query joining one or more tables.

CREATE VIEW view name AS

SELECT columns

FROM tables

[WHERE conditions];

Can we delete a record in view?

Can we delete a record more than one table?

DELETE FROM usession

WHERE session_id = (SELECT session_id

FROM usession

WHERE delete_session_id IS NULL

AND user_id = (SELECT user_id

FROM users

WHERE REGEXP_LIKE(USER_NAME,

'awpeople', 'i')));

Page 22: Top MNC'S Interview questions and answers

Can we write trigger on view?

Create trigger tri_account

Before insert or update

on account

for each row

Begin

IF (:new.acct_id = 2 and :new.cust_id = 23) THEN

raise_application_error( -20001, 'No insertion with id 2 and 23.');

END IF;

end;

Do you have use any debugging tool?

Do you know global variable, difference between global variable and parameter variable?

Well, basically, a global variable is a variable that can be used anywhere. But local variable is

a variable that can be used in with in sub programs.

Do you know about cascading triggers?

When a statement in a trigger body causes another trigger to be fired, the triggers are said to be cascading. Max = 32. 

a) Commiting : A transaction is said to be commited when the transaction makes permanent changes resulting from the SQL statements.

b) Rollback : A transaction that retracts any of the changes resulting from SQL statements in Transaction.

c) SavePoint : For long transactions that contain many SQL statements, intermediate markers or savepoints are declared. Savepoints can be used to divide a transactino into smaller points. d) Rolling Forward :: Process of applying redo log during recovery is called rolling forward.

What are Database Triggers and Stored Procedures?

Database Triggers:-Database Triggers are Procedures that are automatically executed as a result of insert in, update to, or delete from table. Database triggers have the values old and new to denote the old value in the table before it is deleted and the new indicated the new value that will be used. DT are useful for implementing complex business rules which cannot be enforced using the integrity rules. We can have the trigger as before trigger or After

Page 23: Top MNC'S Interview questions and answers

Trigger and at Statement or Row level. e.g.:: operations insert, update ,delete 3 before ,after 3*2 A total of 6 combinations At statement level(once for the trigger) or row level( for every execution ) 6 * 2 A total of 12. Thus a total of 12 combinations are there and the restriction of usage of 12 triggers has been lifted from Oracle 7.3 Onwards. Stored Procedures:: Stored Procedures are Procedures that are stored in Compiled form in the database. The advantage of using the stored procedures is that many users can use the same procedure in compiled and ready to use format.

CTS PL/SQL Interview Questions

Tell me something your self?

What are the activities are you doing daily in your project?

Tell me ratio's of sql,pl/sql&unix?

Diff b/w primary key & unique key ?

Diff b/w primary key & unique key + not null?

What is the use of views? If table dropped, then what happen view?

What is index? types of indexes?

Which functions are not supported to index? What is save point? What is ora-1555?

What are the datatypes avilable in pl/sql, not in sql?

What is the main use of %type,%rowtype? What is cursor? Types of cursors?

Diff b/w explict cursor & for loop cursor?

What is exception?

Types of exceptions?

What is raise_application_error?

What is pragma_exception_init?

Diff b/w triggers&procedures? Can you call procedure in select statement? Restrictions in functions?

What is the use of packages? How to drop package body only? Can use pragma_autonamous_tranctions in packages?

What is bulk collect? What is nullif()? What is mutating error?

Page 24: Top MNC'S Interview questions and answers

What are the module's , you are working Which will fire default first statement level or row level trigger?

What is bulkcollect? And any restrictions in bulkcollect? What is the use of limit clause in bulkcollect?

How to debugg your code? How to trace error handling?

How to find which line error was raised?

What are the methods there in save exceptions?

What is functional based index? Write syntax?

How to update complex view? Can you alter procedure with in package? Is it possible to open cursor which is in package in another procrdure?

What is substr()&instr()? Difference between case and decode? Can you use sysdate in check constraints? If no, why?

Difference between column level constraints & table level constraints? What is optimizer?

What is nested_loop join? What is pivot operater? Tell me some oracle 10g features?

What is m_view? What is master & detail tables? What is sqlcode and sqlerrm?

Diff b/w procedure & packages? What are the dis_adv of packages? Tell me some strong points in your boss?

What is Profile? Explain different levels of Profile?

A user profile is a set of changeable options that affects the way your applications run. Oracle Application Object Library establishes a value for each option in a user‟s profile when the user logs on or changes responsibility. Your user can change the value of profile options at any time a) To create Profile Option. ( Profile Option can created by developer in application developer area) b)set the value (Values of the profile option , who will have what value at various levels is set by SYSADMIN). Oracle Application Object Library provides many options that. (Edit profile feature for every user is available to set any value to allow the user).your users can set to alter the user interface of your applications to satisfy their individual preferences. Profile Option – set at run time like – User Related, responsibility, Sequence, Printer, Security.

Values in 4 Levels(HIEARCHY WISE) :- USER RESPONSIBILITY APPLICATION SITE Application Developer create the profile. System Administrator make profile option. (NOTE:- If any change in value, it will active when you re-login or switch to the responsibility.) ( Usage in the multi-tier, the profile is biggest impact)

Page 25: Top MNC'S Interview questions and answers

Difference between View vs Materialized View in database?

Based upon on our understanding of View and Materialized View, Let’s see, some short difference between them :

1) First difference between View and materialized view is that, In Views query result is not stored in the disk or database but Materialized view allow to store query result in disk or table.

2) Another difference between View vs materialized view is that, when we create view using any table, rowid of view is same as original table but in case of Materialized view rowid is different.

3) One more difference between View and materialized view in database is that, In case of View we always get latest data but in case of Materialized view we need to refresh the view for getting latest data.

4) Performance of View is less than Materialized view.

5) This is continuation of first difference between View and Materialized View, In case of view its only the logical view of table no separate copy of table but in case of Materialized view we get physically separate copy of table

6) Last difference between View vs Materialized View is that, In case of Materialized view we need extra trigger or some automatic method so that we can keep MV refreshed, this is not required for views in database.

TABLE/FIELD FOR SALES ORDER'S SHIP TO LOCATION

select rsua.location ship_to_location,raa.ADDRESS1 Ship_To_address1, raa.ADDRESS2 Ship_to_Address2, raa.address3 Ship_to_address3, raa.countryfrom ra_site_uses_all rsua,ra_addresses_all raa,oe_order_headerS_all oha,

Page 26: Top MNC'S Interview questions and answers

wsh_delivery_details wddwhere wdd.ship_to_site_use_id = rsua.SITE_USE_ID andoha.order_number = '3022004731' and -- Sales Order Numberoha.header_id = wdd.source_header_id andraa.address_id = rsua.address_id

OR

select a.order_number, d.account_number, e.party_namefrom oe_order_headers_all a,hz_cust_site_uses_all b, -- uses of customer addressesHZ_CUST_ACCT_SITES_ALL c, -- customer addresseshz_cust_accounts d, -- customer accountshz_parties e -- partieswhere a.ship_to_org_id = b.site_use_id -- or a.invoice_to_org_idand b.cust_acct_site_id = c.cust_acct_site_idand c.cust_account_id = d.cust_account_idand d.party_id = e.party_id;

Joins:

GL AND AP

GL_CODE_COMBINATIONS AP_INVOICES_ALLcode_combination_id = acct_pay_code_combination_id

GL_CODE_COMBINATIONS AP_INVOICES_DISTRIBUTIONS_ALLcode_combination_id = dist_code_combination_id

GL_SETS_OF_BOOKS AP_INVOICES_ALLset_of_books_id = set_of_books_id

GL AND ARGL_CODE_COMBINATIONS RA_CUST_TRX_LINE__GL_DIST_ALLcode_combination_id = code_combination_id

Page 27: Top MNC'S Interview questions and answers

GL AND INVGL_CODE_COMBINATIONS MTL_SYSTEM_ITEMS_Bcode_combination_id = cost_of_sales_account

GL AND POGL_CODE_COMBINATIONS PO_DISTRIBUTIONS_ALLcode_combination_id = code_combination_id

PO AND APPO_DISTRIBUTIONS_ALL AP_INVOICE_DISTRIBUTIONS_ALLPo_distribution_id = po_distribution_id

PO_VENDORS AP_INVOICES_ALLvendor_id = vendor_id

PO AND SHIPMENTSPO_HEADERS_ALL RCV_TRANSACTIONSPo_header_id = po_header_id

PO_DISTRIBUTIONS_ALL RCV_TRANSACTIONSPo_distribution_id = po_distribution_id

SHIPMENTS AND INVOICERCV_TRANSACTIONS AP_INVOICE_DISTRIBUTIONS_ALLRCV_TRANSACTION_ID = RCV_TRANSACTION_ID

PO AND INVPO_REQUISITION_LINES_ALL MTL_SYSTEM_ITEMS_Bitem_id = inventory_item_idorg_id = organization_id

PO AND HRMSPO_HEADERS_ALL HR_EMPLOYEESAgent_id = employee_id

PO AND REQUISITIONPO_DISTRIBUTIONS_ALL PO_REQ_DISTRIBUTIONS_ALLreq_distribution_id = distribution_id

SHIPMENTS AND INVRCV_TRANSACTIONS MTL_SYSTEM_ITEMS_BOrganization_id = organization_id

INV AND HRMS

Page 28: Top MNC'S Interview questions and answers

MTL_SYSTEM_ITEMS_B HR_EMPLOYEESbuyer_id = employee_id

OM AND AROE_ORDER_HEADERS_ALL RA_CUSTOMER_TRX_LINES_ALLTO_CHAR( Order_number) = interface_line_attribute1

OE_ORDER_LINES_ALL RA_CUSTOMER_TRX_LINES_ALLTO_CHAR(Line_id) = interface_line_attribute6

OE_ORDER_LINES_ALL RA_CUSTOMER_TRX_LINES_ALLreference_customer_trx_line_id = customer_trx_line_id

OM AND SHIPPINGOE_ORDER_HEADERS_ALL WSH_DELIVARY_DETAILSHEADER_ID = SOURCE_HEADER_IDOE_ORDER_HEADERS_ALL WSH_DELIVARY_DETAILSLINE_ID = SOURCE_LINE_ID

AP AND AR (BANKS)AR_CASH_RECEIPTS_ALL AP_BANK_ACCOUNTSREMITTANCE_BANK_ACCOUNT_ID = ABA.BANK_ACCOUNT_ID

AP AND ARHZ_PARTIES AP_INVOICES_ALLPARTY_ID = PARTY_ID

OM AND CRMOE_ORDER_LINES_ALL CSI_ITEM_INSTANCES(Install Base)LINE_ID = LAST_OE_ORDER_LINE_ID

Po_Requisition_Headers_AllColumn Names Table Name Column NameREQUISITION_HEADER_IDPO_REQUISITION_LINES_ALL REQUISITION_HEADER_IDTYPE_LOOKUP_CODE PO_DOCUMENT_TYPES DOCUMENT_SUBTYPEPREPARER_ID PER_PEOPLE_F PERSON_IDORG_ID MTL_SYSTEM_ITEMS ORGANIZATION_IDORG_ID MTL_ORGANIZATIONS ORGANIZATION_ID

Po_Requisition_Lines_AllColumn Names Table Name Column NameREQUISITION_HEADER_ID PO_REQUISITION_HEADERS_ALL REQUISITION_HEADER_IDREQUISITION_LINE_ID PO_REQ_DISTRIBUTIONS_ALL REQUISITION_LINE_IDLINE_TYPE_ID PO_LINE_TYPES LINE_TYPE_IDITEM_ID MTL_SYSTEM_ITEMS INVENTORY_ITEM_IDORG_ID MTL_SYSTEM_ITEMS ORGANIZATION_ID

Page 29: Top MNC'S Interview questions and answers

Po_Requisition_Distributions_AllColumn Names Table Name Column NameREQUISITION_LINE_ID PO_REQUISITION_LINES_ALL REQUISITION_LINE_IDDISTRIBUTION_ID PO_DISTRIBUTIONS_ALL REQ_DISTRIBUTION_IDSET_OF_BOOKS_ID GL_SETS_OF_BOOKS SET_OF_BOOKS_IDCODE_COMBINATION_ID GL_CODE-COMBINATIONS CODE_COMBINATION_ID

Po_Distributions_AllColumn Names Table Name Column NamePO_LINE_ID PO_LINES PO_LINE_IDREQ_DISTRIBUTION_ID PO_REQ_DISTRIBUTIONS_ALL DISTRIBUTION_IDPO_DISTRIBUTION_ID AP_INVOICE_DISTRIBUTIONS_ALL PO_DISTRIBUTION_ID

Po_Headers_AllColumn Names Table Name Column NamePO_HEADER_ID PO_LINES PO_HEADER_IDPO_HEADER_ID RCV_SHIPMENT_LINES PO_HEADER_IDVENDOR_ID PO_VENDORS VENDOR_IDAGENT_ID PER_PEOPLE PERSON_IDTYPE_LOOK_UP_CODE PO_DOCUMENT_TYPES DOCUMENT_SUBTYPE

Po_Lines_AllColumn Names Table Name Column NamePO_HEADER_ID PO_HEADERS PO_HEADER_IDPO_LINE_ID PO_DISTRIBUTIONS_ALL PO_LINE_IDITEM_ID MTL_SYSTEM_ITEMS ITEM_ID

Rcv_Shipment_LinesColumn Names Table Name Column NamePO_HEADER_ID PO_HEADERS PO_HEADER_IDSHIPMENT_HEADER_ID RCV_SHIPMENT_HEADERS SHIPMENT_HEADER_ID

Ap_Invoices_AllColumn Names Table Name Column NameINVOICE_ID AP_INVOICE_DISTRIBUTIONS_ALL INVOICE_ID

Oe_Order_Headers_AllColumn Names Table Name Column NameHEADER_ID OE_ORDER_LINES HEADER_IDSOURCE_HEADER_ID WISH_DELIVERY_DETAILS SOURCE_HEADER_IDPRICE_LIST_ID QP_LIST_HEADERS_TL LIST_HEADER_IDORG_ID MTL_ORGANIZATIONS ORGANIZATION_IDSALESREP_ID JTF_RS_SALESREPS SALESREP_IDORDER_TYPE_ID OE_TRANSACTION_TYPES TRANSACTION_TYPE_IDORDER_SOURCE_ID OE_ORDER_SOURCES ORDER_SOURCE_ID

Page 30: Top MNC'S Interview questions and answers

ACCOUNTING_RULE_ID RA_RULES RULE_IDPAYMENT_TERM_ID RA_TERMS TERM_IDSOLD_TO_ORG_ID HZ_CUST_ACCOUNTS CUST_ACCOUNT_IDSHIP_FROM_ORG_ID MTL_PARAMETERS ORGANIZATION_IDSHIP_TO_ORG_ID HZ_CUST_SITE_USES_ALL SITE_USE_ID

Oe_Order_Lines_AllColumn Names Table Name Column NameLINE_TYPE_ID OE_TRANSACTION_TYPES_TL TRANSACTION_TYPE_IDINVOICING_RULE_ID RA_RULES RULE_ID

Hz_PartiesColumn Names Table Name Column NamePATY_ID HZ_CUST_ACCOUNTS PATY_IDCUST_ACCOUNT_ID OE_ORDER_LINES SOLD_TO_ORG_ID

Hz_Party_Sites_AllColumn Names Table Name Column NamePATY_ID HZ_PARTIES PATY_ID LOCATION_ID HZ_LOCATIONS LOCATION_ID

Wsh_delivery_detailsColumn Names Table Name Column NameSOURCE_HEADER_ID OE_ORDER_HEADERS SOURCE_HEADER_IDDELIVERY_DETAIL_ID WSH_DELIVERY_ASSIGNMENTS DELIVERY_DETAIL_IDDELIVERY_ID WSH_NEW_DELIVERIES DELIVERY_IDINVENTORY_ITEM_ID MTL_SYSTEM_ITEMS INVENTORY_ITEM_ID

RA_CUSTOMER_TRX_ALLColumn Names Table Name Column NameCUSTOMER_TRX_ID AR_RECEIVABLE_APPLICATIONS_ALL APPLIED_CUSTOMER_TRX_IDTERM_ID                     RA_TERMS TERM_IDCUSTOMER_TRX_ID RA_CUST_TRX_LINE_GL_DIST CUSTOMER_TRX_ID

AR_CASH_REC EIPTS_ALLColumn Names Table Name Column NameCASH_RECEIPT_ID AR_RECEIVABLE_APPLICATIONS_ALL CASH_RECEIPT_IDSET_OF_BOOKS_ID GL_SETS_OF_BOOKS SET_OF_BOOKS_ID

What is the Diff between APPS Schema and other Schemas?

Apps schema contains only Synonyms we can't create tables in apps schema, where as other schemas

Page 31: Top MNC'S Interview questions and answers

contains tables, & all the objects. Here only we will create the tables and giving grants on created tables.

Almost all every time we will connect to apps schema only.

What is meant by Custom Top and what is the Purpose?

Custom Top is nothing but Customer Top, which is created for customer only. we can have multiple customtops based on client requirement. It is used to store developed & customized components.

Whenever oracle corporations applying patches it will over ride on all the modules except custom top.

That’s why we will use custom top.

FND USER EXITS:-

FND SRWINIT sets your profile option values, multiple organizations and allowsOracle Application Object Library user exits to detect that they have been called by an Oracle Reports program.FND SRWEXIT ensures that all the memory allocated for AOL user exits have been freed up properly.FND FLEXIDVAL are used to display flex field information like prompt, value etcFND FLEXSQL these user exits allow you to use flex fields in your reportsFND FORMAT_CURRENCY is used to print currency in various formats by using formula column