Oracle Placement-Paper

Section Name

A.      General  Aptitude-40 Questions

B.      English Proficiency-20 questions

 

·         Please follow the instructions given by the room invigilator before you

 

·         Shade/mark/indicate your correct choices on the answer sheet

 

·         The test paper consists of Multiple Choice Question Only

 

·         The test paper consists of 60 questions

 

·         The Total duration of the test is 60 Minutes

 

·         Each question will have 4 choices with only one correct answer

 

·         There will be negative marking for attempted wrong answers

 

·         Please mark on the right option only

 

·         If a page is not printed or misprinted, please inform the room invigilator immediately for replacement

 

·         You are allowed to use Black/Blue Ball Point Pen only to write answers

 

·         Usage of whitener/eraser is not allowed

 

·         Do Not make any stray marks either on the question booklet or anywhere on the answer sheet

 

·         Please leave behind both your question booklet and your answer sheet at the end of your test.  You are NOT allowed to carry either of them after your test

 

·         Any candidate indulging in malpractices or creating disturbance of any sort, will be asked to leave the testing premises immediately

 

·         The room Invigilator is the official time keep: NO EXTRA TIME will be granted beyond the stipulated test duration

 

 

ORACLE Job Placement Paper

Paper Type : Technical – Database

Oracle DBA Questions

1SNAPSHOT is used for [DBA]
a. Synonym, b. Table space, c System server, d Dynamic data replication Ans : D

2We can create SNAPSHOTLOG for[DBA]
a. Simple snapshots, b. Complex snapshots, c. Both A & B, d Neither A nor B Ans : A

3Transactions per rollback segment is derived from[DBA]
a. Db_Block_Buffers, b. Processes, c. Shared_Pool_Size, d. None of the above
Ans : B

4ENQUEUE resources parameter information is derived from[DBA]
a. Processes or DDL_LOCKS and DML_LOCKS, b. LOG_BUFFER, c. DB__BLOCK_SIZE..
Ans : A

5LGWR process writes information into
a Database files, b Control files, c Redolog files, d All the above. Ans : C

6SET TRANSACTION USE ROLLBACK SEGMENT is used to create user objects in a particular Tablespace
a True, b False Ans : False

7 Databases overall structure is maintained in a file called
a Redolog file, b Data file, c Control file, d All of the above.
Ans : C

8These following parameters are optional in init.ora parameter file DB_BLOCK_SIZE, PROCESSES
a True, b False Ans : False

9Constraints cannot be exported through EXPORT command
a True, b False Ans : False

10 It is very difficult to grant and manage common privileges needed by different groups of database users using the roles
a True, b False Ans : False

11 What is difference between a DIALOG WINDOW and a DOCUMENT WINDOW regarding moving the window with respect to the application window
a Both windows behave the same way as far as moving the window is concerned.
b A document window can be moved outside the application window while a dialog window cannot be moved
c A dialog window can be moved outside the application window while a document window cannot be moved
Ans : C

12What is the difference between a MESSAGEBOX and an ALERT
A message box can be used only by the system and cannot be used in user application while an alert can be used in user application also.

13A alert can be used only by the system and cannot be use din user application while an message box can be used in user application also.

14 An alert requires an response from the user while a message box just flashes a message and only requires an acknowledgment from the user

15 An message box requires an response from the user while a alert just flashes a message an only requires an acknowledgment from the user

16 Which of the following is not an reason for the fact that most of the processing is done at the server ?
a To reduce network traffic. b For application sharing, c To implement business rules centrally,d None of the above
Ans : D

17 Can a DIALOG WINDOW have scroll bar attached to it ?
a Yes, b No Ans : B

18.Which of the following is not an advantage of GUI systems ?
a. Intuitive and easy to use., b. GUI’s can display multiple applications in multiple windows
c. GUI’s provide more user interface objects for a developer d. None of the above
Ans 😀

19.What is the difference between a LIST BOX and a COMBO BOX ?
a In the list box, the user is restricted to selecting a value from a list but in a combo box the user can type in value which is not in the list
b A list box is a data entry area while a combo box can be used only for control purposes
c In a combo box, the user is restricted to selecting a value from a list but in a list box the user can type in a value which is not in the list
d None of the above
Ans : A

20 In a CLIENT/SERVER environment , which of the following would not be done at the client ?
a User interface part, b Data validation at entry line, c Responding to user events,
d None of the above Ans : D

21Why is it better to use an INTEGRITY CONSTRAINT to validate data in a table than to use a STORED PROCEDURE ?
a Because an integrity constraint is automatically checked while data is inserted into or updated in a table while a stored procedure has to be specifically invoked
b Because the stored procedure occupies more space in the database than a integrity constraint definition
c Because a stored procedure creates more network traffic than a integrity constraint definition
Ans : A

22Which of the following is not an advantage of a client/server model ?
a. A client/server model allows centralised control of data and centralised implementation of business rules.
b A client/server model increases developer;s productivity
c A client/server model is suitable for all applications
d None of the above.
Ans : C

23 What does DLL stands for ?
a Dynamic Language Library
b Dynamic Link Library
c Dynamic Load Library
d None of the above
Ans : B

24.POST-BLOCK trigger is a
a Navigational trigger
b Key trigger
c Transactional trigger
d None of the above
Ans : A

25 The system variable that records the select statement that SQL * FORMS most recently used
to populate a block is
a SYSTEM.LAST_RECORD
b SYSTEM.CURSOR_RECORD
c SYSTEM.CURSOR_FIELD
d SYSTEM.LAST_QUERY
Ans: D

26 Which of the following is TRUE for the ENFORCE KEY field
a ENFORCE KEY field characterstic indicates the source of the value that SQL*FORMS uses to populate the field
b A field with the ENFORCE KEY characterstic should have the INPUT ALLOWED charaterstic turned off
a Only 1 is TRUE
b Only 2 is TRUE
c Both 1 and 2 are TRUE
d Both 1 and 2 are FALSE
Ans : A

27 What is the maximum size of the page ?
a Characters wide & 265 characters length
b Characters wide & 265 characters length
c Characters wide & 80 characters length
d None of the above
Ans : B

28 A FORM is made up of which of the following objects
a block, fields only,
b blocks, fields, pages only,
c blocks, fields, pages, triggers and form level procedures,
d Only blocks.
Ans : C

29 For the following statements which is true
1 Page is an object owned by a form
2 Pages are a collection of display information such as constant text and graphics.
a Only 1 is TRUE
b Only 2 is TRUE
c Both 1 & 2 are TRUE
d Both are FALSE
Ans : B

30 The packaged procedure that makes data in form permanent in the Database is
a Post
b Post form
c Commit form
d None of the above
Ans : C

31Which of the following is TRUE for the SYSTEM VARIABLE $$date$$
a Can be assigned to a global variable
b Can be assigned to any field only during design time
c Can be assigned to any variable or field during run time
d None of the above
Ans : B

32Which of the following packaged procedure is UNRESTRICTED ?
a CALL_INPUT, b CLEAR_BLOCK, c EXECUTE_QUERY, d USER_EXIT
Ans : D

33.Identify the RESTRICTED packaged procedure from the following
a USER_EXIT, b MESSAGE, c BREAK, d EXIT_FORM
Ans : D

33.What is SQL*FORMS
a SQL*FORMS is a 4GL tool for developing & executing Oracle based interactive applications.
b SQL*FORMS is a 3GL tool for connecting to the Database.
c SQL*FORMS is a reporting tool
d None of the above.
Ans : A

34.Name the two files that are created when you generate a form using Forms 3.0
a FMB & FMX, b FMR & FDX, c INP & FRM, d None of the above
Ans : C

35 What is a trigger
a A piece of logic written in PL/SQL
b Executed at the arrival of a SQL*FORMS event
c Both A & B
d None of the above
Ans : C

36 Which of the folowing is TRUE for a ERASE packaged procedure
1 ERASE removes an indicated Global variable & releases the memory associated with it
2 ERASE is used to remove a field from a page
1 Only 1 is TRUE
2 Only 2 is TRUE
3 Both 1 & 2 are TRUE
4 Both 1 & 2 are FALSE
Ans : 1

37 All datafiles related to a Tablespace are removed when the Tablespace is dropped
a TRUE
b FALSE
Ans : B

38 Size of Tablespace can be increased by
a Increasing the size of one of the Datafiles
b Adding one or more Datafiles
c Cannot be increased
d None of the above
Ans : B

39 Multiple Tablespaces can share a single datafile
a TRUE
b FALSE
Ans : B

40 A set of Dictionary tables are created
a Once for the Entire Database
b Every time a user is created
c Every time a Tablespace is created
d None of the above
Ans : A

41 Datadictionary can span across multiple Tablespaces
a TRUE
b FALSE
Ans : B

42 What is a DATABLOCK
a Set of Extents
b Set of Segments
c Smallest Database storage unit
d None of the above
Ans : C

43 Can an Integrity Constraint be enforced on a table if some existing table data does not satisfy the constraint
a Yes
b No
Ans : B

44 A column defined as PRIMARY KEY can have NULL’s
a TRUE
b FALSE
Ans : B

45 A Transaction ends
a Only when it is Committed
b Only when it is Rolledback
c When it is Committed or Rolledback
d None of the above
Ans : C

46 A Database Procedure is stored in the Database
a In compiled form
b As source code
c Both A & B
d Not stored
Ans : C
47 A database trigger does not apply to data loaded before the definition of the trigger
a TRUE
b FALSE
Ans : A

48 Dedicated server configuration is
a One server process – Many user processes
b Many server processes – One user process
c One server process – One user process
d Many server processes – Many user processes
Ans : C

49 Which of the following does not affect the size of the SGA
a Database buffer
b Redolog buffer
c Stored procedure
d Shared pool
Ans : C

50 What does a COMMIT statement do to a CURSOR
a Open the Cursor
b Fetch the Cursor
c Close the Cursor
d None of the above
Ans : D

51 Which of the following is TRUE
1 Host variables are declared anywhere in the program
2 Host variables are declared in the DECLARE section
a Only 1 is TRUE
b Only 2 is TRUE
c Both 1 & 2are TRUE
d Both are FALSE
Ans : B

52 Which of the following is NOT VALID is PL/SQL
a Bool boolean;
b NUM1, NUM2 number;
c deptname dept.dname%type;
d date1 date := sysdate
Ans : B

Declare
fvar number := null; svar number := 5
Begin
goto << fproc>>
if fvar is null then
<< fproc>>
svar := svar + 5
end if;
End;

53 What will be the value of svar after the execution ?
a Error
b 10
c 5
d None of the above
Ans : A

54 Which of the following is not correct about an Exception ?
a Raised automatically / Explicitly in response to an ORACLE_ERROR
b An exception will be raised when an error occurs in that block
c Process terminates after completion of error sequence.
d A Procedure or Sequence of statements may be processed.
Ans : C

55Which of the following is not correct about User_Defined Exceptions ?
a Must be declared
b Must be raised explicitly
c Raised automatically in response to an Oracle error
d None of the above
Ans : C

56 A Stored Procedure is a
a Sequence of SQL or PL/SQL statements to perform specific function
b Stored in compiled form in the database
c Can be called from all client environmets
d All of the above
Ans : D

57 Which of the following statement is false
a Any procedure can raise an error and return an user message and error number
b Error number ranging from 20000 to 20999 are reserved for user defined messages
c Oracle checks Uniqueness of User defined errors
d Raise_Application_error is used for raising an user defined error.
Ans : C

58 Is it possible to open a cursor which is in a Package in another procedure ?
a Yes
b No
Ans : A
59 Is it possible to use Transactional control statements in Database Triggers?
a Yes
b No
Ans : B

60 Is it possible to Enable or Disable a Database trigger ?
a Yes
b No
Ans : A

61 PL/SQL supports datatype(s)
a Scalar datatype
b Composite datatype
c All of the above
d None of the above
Ans C

62 Find the ODD datatype out
a VARCHAR2
b RECORD
c BOOLEAN
d RAW
Ans : B

63 Which of the following is not correct about the “TABLE” datatype ?
a Can contain any no of columns
b Simulates a One-dimensional array of unlimited size
c Column datatype of any Scalar type
d None of the above
Ans : A

63 Find the ODD one out of the following
a OPEN
b CLOSE
c INSERT
d FETCH
Ans C

64 Which of the following is not correct about Cursor ?
a Cursor is a named Private SQL area
b Cursor holds temporary results
c Cursor is used for retrieving multiple rows
d SQL uses implicit Cursors to retrieve rows
Ans : B

65 Which of the following is NOT VALID in PL/SQL ?
a Select … into
b Update
c Create
d Delete
Ans : C

66 What is the Result of the following ‘VIK’||NULL||’RAM’ ?
a Error
b VIK RAM
c VIKRAM
d NULL
Ans : C

67 Declare
a number := 5; b number := null; c number := 10;
Begin
if a > b AND a < c then
a := c * a;
end if;
End;

68 What will be the value of ‘a’ after execution ?
a 50
b NULL
c 5
d None of the above
Ans : C

69 Does the Database trigger will fire when the table is TRUNCATED ?
a Yes
b No
Ans : B

70 SUBSTR(SQUARE ANS ALWAYS WORK HARD,14,6) will return
a ALWAY
b S ALWA
c ALWAYS
Ans : C

71 REPLACE(‘JACK AND JUE’,’J’,’BL’) will return
a JACK AND BLUE
b BLACK AND JACK
c BLACK AND BLUE
d None of the above
Ans : C

72 TRANSLATE(‘333SQD234′,’0123456789ABCDPQRST’,’0123456789′) will return
a 333234
b 333333
c 234333
d None of the above
Ans : A

73 EMPNO ENAME SAL
A822 RAMASWAMY 3500
A812 NARAYAN 5000
A973 UMESH 2850
A500 BALAJI 5750

74 Use these data for the following Questions
Select SAL from EMP E1 where 3 > ( Select count(*) from Emp E2 where E1.SAL > E2.SAL ) will retrieve
a 3500,5000,2500
b 5000,2850
c 2850,5750
d 5000,5750
Ans : A

75 Is it possible to modify a Datatype of a column when column contains data ?
a Yes
b No
Ans B

76 Which of the following is not correct about a View ?
a To protect some of the columns of a table from other users
b Ocuupies data storage space
c To hide complexity of a query
d To hide complexity of a calculations
Ans : B

77Which is not part of the Data Definiton Language ?
a CREATE
b ALTER
c ALTER SESSION
Ans : C

78 The Data Manipulation Language statements are
a INSERT
b UPDATE
c SELECT
d All of the above
Ans : D

79 EMPNO ENAME SAL
A822 RAMASWAMY 3500
A812 NARAYAN 5000
A973 UMESH
A500 BALAJI 5750
Using the above data
Select count(sal) from Emp will retrieve
a 1
b 0
c 3
d None of the above
Ans : C

80 If an UNIQUE KEY constraint on DATE column is created, will it accept the rows that are inserted with
SYSDATE ?
a Will
b Won’t
Ans : B

81 What are the different events in Triggers ?
a Define, Create
b Drop, Comment
c Insert, Update, Delete
d All of the above
Ans : C

82 What built-in subprogram is used to manipulate images in image items ?
a Zoom_out
b Zoom_in’
c Image_zoom
d Zoom_image
Ans : C

83 Can we pass RECORD GROUP between FORMS ?
a Yes
b No
Ans : A

84 SHOW_ALERT function returns
a Boolean
b Number
c Character
d None of the above
Ans : B

85 What SYSTEM VARIABLE is used to refer DATABASE TIME ?
a $$dbtime$$
b $$time$$
c $$datetime$$
d None of the above
Ans : A

86 SYSTEM.EFFECTIVE.DATE varaible is
a Read only
b Read & Write
c Write only
d None of the above
Ans : C

87 How can you CALL Reports from Forms4.0 ?
a Run_Report built_in
b Call_Report built_in
c Run_Product built_in
d Call_Product built_in
Ans : C

88 When do you get a .PLL extension ?
a Save Library file
b Generate Library file
c Run Library file
d None of the above
Ans : A

89 What is built_in Subprogram ?
a Stored procedure & Function
b Collection of Subprogram
c Collection of Packages
d None of the above
Ans : D

90 GET_BLOCK property is a
a Restricted procedure
b Unrestricted procedure
c Library function
d None of the above
Ans : D

91 A CONTROL BLOCK can sometimes refer to a BASETABLE ?
a TRUE
b FALSE
Ans : B

92 What do you mean by CHECK BOX ?
a Two state control
b One state control
c Three state control
d none of the above
Ans : C – Please check the Correcness of this Answer ( The correct answeris 2 )

92 List of Values (LOV) supports
a Single column
b Multi column
c Single or Multi column
d None of the above
Ans : C

93.What is Library in Forms 4.0 ?
a Collection of External field
b Collection of built_in packages
c Collection of PL/SQl functions, procedures and packages
d Collection of PL/SQL procedures & triggers
Ans : C

94 Can we use a RESTRICTED packaged procedure in WHEN_TEXT_ITEM trigger ?
a Yes
b No
Ans : B

95 Can we use GO_BLOCK package in a PRE_TEXT_ITEM trigger ?
a Yes
b No
Ans : B

96 What type of file is used for porting Forms 4.5 applications to various platforms ?
a . FMB file
b . FMX file
c . FMT file
d . EXE file
Ans : C

97 What built_in procedure is used to get IMAGES in Forms 4.5 ?
a READ_IMAGE_FILE
b GET_IMAGE_FILE
c READ_FILE
d GET_FILE
Ans A

98 When a form is invoked with CALL_FORM does Oracle forms issues SAVEPOINT ?
a Yes
b No
Ans : A

100 Can we attach the same LOV to different fields in Design time ?
a Yes
b No
Ans : A

1How do you pass values from one form to another form ?
a LOV
b Parameters
c Local variables
d None of the above
Ans : B

2Can you copy the PROGRAM UNIT into an Object group ?
a Yes
b No
Ans : B

100. Can MULTIPLE DOCUMENT INTERFACE (MDI) be used in Forms 4.5 ?
a Yes
b No
Ans : A

3Can MULTIPLE DOCUMENT INTERFACE (MDI) be used in Forms 4.5 ?
a Yes
b No
Ans : A

3When is a .FMB file extension is created in Forms 4.5 ?
a Generating form
b Executing form
c Save form
d Run form
Ans : C

5What is a Built_in subprogram ?
a Library
b Stored procedure & Function
c Collection of Subprograms
d None of the above
Ans : D

What is a RADIO GROUP ?
a Mutually exclusive
b Select more than one column
c Above all TRUE
d Above all FALSE
Ans : A

Identify the Odd one of the following statements ?
a Poplist
b Tlist
c List of values
d Combo box
Ans : C

What is an ALERT ?
a Modeless window
b Modal window
c Both are TRUE
d None of the above
Ans : B

Can an Alert message be changed at runtime ?
a Yes
b No
Ans : A

Can we create an LOV without an RECORD GROUP ?
a Yes
b No
Ans : B

How many no of columns can a RECORD GROUP have ?
a 10
b 20
c 50
d None of the above
Ans D

Oracle precompiler translates the EMBEDDED SQL statemens into
a Oracle FORMS
b Oracle REPORTS
c Oracle LIBRARY
d None of the above
Ans : D

Kind of COMMENT statements placed within SQL statements ?
a Asterisk(*) in column ?
b ANSI SQL style statements(…)
c C-Style comments (/*……*/)
d All the above
Ans : D

What is TERM ?
a TERM is the terminal definition file that describes the terminal from which you are using R20RUN
( Reports run time )
b TERM is the terminal definition file that describes the terminal from which you are using R20DES
( Reports designer )
c There is no Parameter called TERM in Reports 2.0
d None of the above
Ans : A

If the maximum records retrieved property of a query is set to 10, then a summary value will
be calculated
a Only for 10 records
b For all the records retrieved
c For all therecords in the referenced table
d None of the above
Ans : A

With which function of a summary item in the COMPUTE AT optio required ?
a Sum
b Standard deviation
c Variance
d % of Total function
Ans : D

For a field in a repeating frame, can the source come from a column which does not exist in
the datagroup which forms the base of the frame ?
a Yes
b No
Ans : A

What are the different file extensions that are created by Oracle Reports ?
a . RDF file & .RPX file
b . RDX file & .RDF file
c . REP file & .RDF file
d None of the above
Ans : C

Is it possible to Disable the Parameter form while running the report?
a Yes
b No
Ans : A

What are the SQL clauses supported in the link property sheet ?
a WHERE & START WITH
b WHERE & HAVING
c START WITH & HAVING
d WHERE, START WITH & HAVING
Ans : D

What are the types of Calculated columns available ?
a Summary, Place holder & Procedure column
b Summary, Procedure & Formula columns
c Procedure, Formula & Place holder columns
d Summary, Formula & Place holder columns
Ans.: D

If two groups are not linked in the data model editor, what is the hierarchy between them?
a There is no hierarchy between unlinked groups
b The group that is right ranks higher than the group that is to theleft
c The group that is above or leftmost ranks higher than the group that is to right or below it
d None of the above
Ans : C

Sequence of events takes place while starting a Database is
a Database opened, File mounted, Instance started
b Instance started, Database mounted & Database opened
c Database opened, Instance started & file mounted
d Files mounted, Instance started & Database opened
Ans : B

SYSTEM TABLESPACE can be made off-line
a Yes
b No
Ans : B

ENQUEUE_RESOURCES parameter information is derived from
a PROCESS or DDL_LOCKS & DML_LOCKS
b LOG BUFFER
c DB_BLOCK_SIZE
d DB_BLOCK_BUFFERS
Ans : A

SMON process is used to write into LOG files
a TRUE
b FALSE
Ans : B

EXP command is used
a To take Backup of the Oracle Database
b To import data from the exported dump file
c To create Rollback segments
d None of the above
Ans : A

SNAPSHOTS cannot be refreshed automatically
a TRUE
b FALSE
Ans : B

The User can set Archive file name formats
a TRUE
b FALSE
Ans : A

The following parameters are optional in init.ora parameter file DB_BLOCK_SIZE, PROCESS
a TRUE
b FALSE
Ans : B

NOARCHIEVELOG parameter is used to enable the database in Archieve mode
a TRUE
b FALSE
Ans : B

Constraints cannot be exported through Export command?
a TRUE
b FALSE
Ans : B

It is very difficult to grant and manage common priveleges needed by
different groups of database users using roles
a TRUE
b FALSE
Ans : B

The status of the Rollback segment can be viewed through
a DBA_SEGMENTS
b DBA_ROLES
c DBA_FREE_SPACES
d DBA_ROLLBACK_SEG
Ans : D

Explicitly we can assign transaction to a rollback segment
a TRUE
b FALSE
Ans : A

What file is read by ODBC to load drivers ?
a ODBC.INI
b ODBC.DLL
c ODBCDRV.INI
d None of the above
Ans : A
Oracle SQL Questions and answers
Oracle Interview Questions and Answers : SQL
1. To see current user name
Sql> show user;

2. Change SQL prompt name
SQL> set sqlprompt “Manimara > “
Manimara >
Manimara >

3. Switch to DOS prompt
SQL> host

4. How do I eliminate the duplicate rows ?
SQL> delete from table_name where rowid not in (select max(rowid) from table group by
duplicate_values_field_name);
or
SQL> delete duplicate_values_field_name dv from table_name ta where rowid <(select min(rowid) from
table_name tb where ta.dv=tb.dv);
Example.
Table Emp
Empno Ename
101 Scott
102 Jiyo
103 Millor
104 Jiyo
105 Smith
delete ename from emp a where rowid < ( select min(rowid) from emp b where a.ename = b.ename);
The output like,
Empno Ename
101 Scott
102 Millor
103 Jiyo
104 Smith

5. How do I display row number with records?
To achive this use rownum pseudocolumn with query, like SQL> SQL> select rownum, ename from emp;
Output:
1 Scott
2 Millor
3 Jiyo
4 Smith

6. Display the records between two range select rownum, empno, ename from emp where rowid in
(select rowid from emp where rownum <=&upto minus select rowid from emp where rownum<&Start);
Enter value for upto: 10
Enter value for Start: 7
ROWNUM EMPNO ENAME

1 7782 CLARK
2 7788 SCOTT
3 7839 KING
4 7844 TURNER

7. I know the nvl function only allows the same data type(ie. number or char or date Nvl(comm, 0)),
if commission is null then the text “Not Applicable” want to display, instead of blank space. How do I write the query?
SQL> select nvl(to_char(comm.),’NA’) from emp;
Output :
NVL(TO_CHAR(COMM),’NA’)

NA
300
500
NA
1400
NA
NA
8. Oracle cursor : Implicit & Explicit cursors
Oracle uses work areas called private SQL areas to create SQL statements. PL/SQL construct to identify each and every work are used, is called as Cursor.
For SQL queries returning a single row, PL/SQL declares all implicit cursors. For queries that returning more than one row, the cursor needs to be explicitly declared.

9. Explicit Cursor attributes There are four cursor attributes used in Oracle cursor_name%Found, cursor_name%NOTFOUND, cursor_name%ROWCOUNT, cursor_name%ISOPEN

10. Implicit Cursor attributes Same as explicit cursor but prefixed by the word SQL SQL%Found, SQL%NOTFOUND, SQL%ROWCOUNT, SQL%ISOPEN
Tips : 1. Here SQL%ISOPEN is false, because oracle automatically closed the implicit cursor after executing SQL statements.
: 2. All are Boolean attributes.

11. Find out nth highest salary from emp table
SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B
WHERE a.sal<=b.sal);
Enter value for n: 2
SAL
———
3700

12. To view installed Oracle version information SQL> select banner from v$version;

13. Display the number value in Words SQL> select sal, (to_char(to_date(sal,’j’), ‘jsp’))
from emp;
the output like,
SAL (TO_CHAR(TO_DATE(SAL,’J’),’JSP’))

800 eight hundred
1600 one thousand six hundred
1250 one thousand two hundred fifty
If you want to add some text like,
Rs. Three Thousand only.
SQL> select sal “Salary “,
(‘ Rs. ‘|| (to_char(to_date(sal,’j’), ‘Jsp’))|| ‘ only.’))
“Sal in Words” from emp
/
Salary Sal in Words

800 Rs. Eight Hundred only.
1600 Rs. One Thousand Six Hundred only.
1250 Rs. One Thousand Two Hundred Fifty only.
14. Display Odd/ Even number of records Odd number of records:
select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp);
1
3
5
Even number of records:
select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)
2
4
6

15. Which date function returns number value? months_between
16. Any three PL/SQL Exceptions?
Too_many_rows, No_Data_Found, Value_Error, Zero_Error, Others

17. What are PL/SQL Cursor Exceptions?
Cursor_Already_Open, Invalid_Cursor

18. Other way to replace query result null value with a text
SQL> Set NULL ‘N/A’
to reset SQL> Set NULL ‘’

19. What are the more common pseudo-columns?
SYSDATE, USER , UID, CURVAL, NEXTVAL, ROWID, ROWNUM

20. What is the output of SIGN function?
1 for positive value,
0 for Zero,
-1 for Negative value.
21. What is the maximum number of triggers, can apply to a single table?
12 triggers.

Leave a Reply0

Your email address will not be published.