GeekInterview.com
Series: Subject:

PL/SQL FAQ

Showing Questions 1 - 20 of 190 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

What is the main purpose of return in functions?

Asked By: sudnic | Asked On: Apr 10th, 2012

What is the main purpose of return in functions when we can calculate a value and pass it through using out mode in procedure or functions?

Answered by: madhuri_v123 on: May 15th, 2012

RETURN clause in functions is used to return value after executing series of execution steps in a function.

As function can be used in select statement, the output of this statement is nothing but the value RETURN from the function.

Oracle pragma's

Asked By: Nishant.Patel | Asked On: Jul 27th, 2008

Outline the list of pragma's used in Oracle.

Answered by: amrapali on: Apr 21st, 2012

PRAGMA The instruction is a statement that provides some instructions to the compiler. Pragmas are defined in the declarative section in PL/SQL. The following pragmas are available: AUTONOMOUS_TRA...

Answered by: bobbyiiit on: Apr 8th, 2010

PRAGMA

Pragma is a keyword in Oracle PL/SQL that is used to provide an instruction to the compile.

Types Of Pragmas :-

1 - AUTONOMOUS_TRANSACTION

2 - EXCEPTION_INIT

3 - RESTRICT_REFERENCES

4 - SERIALLY_REUSABLE

What is pragma autonomous transaction? Plz can u let me know it in a simple understandable way.Thanks in advance.Byee

Asked By: raj | Asked On: Oct 17th, 2006

Answered by: pragadeesh on: Apr 19th, 2012

Very simple meaning is...
1) Pragama means force (like it says to compiler forcible do this operation)

2) It is used for committing the particular block.

3) We can't rollback this Pragama autonomous block

Answered by: lijina on: Nov 15th, 2011

before that statement that is pragma auto_tra only will save ...

How to get 1st date of a month ?

Asked By: dinaballavsahoo | Asked On: Apr 19th, 2012

During preparation of report in *.Rdf , there are two things on date & to date on date is the i/p value , but to date = 1st day of this month on date how ?

What is difference in defining constraints at table level and column level what is main purpose of making constraints at table level....Pls ans me

Asked By: basukolur014 | Asked On: Nov 5th, 2006

Answered by: Manjesh on: Apr 17th, 2012

yes, it is possible, but u have to use triggers not constraints

Answered by: Dhruva Joshi on: Apr 4th, 2012

To define a constraint at a table level simply reduces the typing part of the
Program...logically
But. The thing is when defining constraint at a column level the rules of it just stay for the particular column but when we want it for one or many column table level
Is to be given

Types of triggers in Oracle

Asked By: GIRISH H.R. | Asked On: Apr 26th, 2006

Answered by: mahamadalig on: Apr 17th, 2012

before trigger
after trigger
row level trigger
statement level trigger

Answered by: prakash on: Feb 28th, 2012

Row level trigger

Index work

Asked By: sarikagopan | Asked On: Sep 21st, 2010

How does index work? How to check whether index is pickup?

Answered by: z_ashwini on: Jan 13th, 2012

Indexes are created for better performance of the DB ; for faster retrival of data from DB. There are diffierent types of indexes... (1) B tree index (2) Bitmap map index (3) Function based index (4) ...

When we can declare a column as unique and not null both at the same time. What is the use PF primary key then?

Asked By: Gupta | Asked On: Aug 7th, 2006

Answered by: z_ashwini on: Jan 13th, 2012

Eg: Consider table emp with EMP_ID,EM|NAME,ADD columns You can define the column e_name as Unique constraint. DECLARE e_name number(10) NOT NULL; BEGIN ... .. END: Primary key cannot have NU...

Answered by: Parmita Mallick on: Sep 7th, 2011

unique key are also indexed. PRIMARY KEY is clustered index whereas UNIQUE KEY is non clustered.

What is cursor? Explain the types of cursor and write one implicit cursor program to check how many records deleted from table?

Asked By: indranil | Asked On: Feb 7th, 2006

Answered by: z_ashwini on: Jan 13th, 2012

Cursors when exected temporary allot spaces in DB. There are 2 types of Cursors: (1) Implicit (2) Explicit (3) Ref cursors Implicit types of cursors are those cursors that are internally used by the ...

Answered by: michael on: Aug 22nd, 2011

when we execute the sql statement from pl/sql it assigns the private work area for that statement.that contain all the information in it.in simplest form cursor is like a pointer in database table

PL/SQL procedure

Asked By: Pallavi_2507 | Asked On: Nov 9th, 2010

What is the difference in create or [replace] procedure and to drop a procedure and create it again? What does replace do, does it drop the existing one and create the new one with same name?

Answered by: z_ashwini on: Jan 13th, 2012

Create procedure_name will create a procedure. If there is an already existing procedure with the same name it will return an error.

Create or replace procedure procedure_name will create an procedure if the same procedure name is non existing else it it overwrite already existing procedure....

Answered by: krishsidd on: Nov 15th, 2010

Replace just recompiles the if the procedure is already existing with the same session settings. However Drop will drop the object from database and then you may need to recreate using create clause as required.

Difference between a cursor and reference cursor

Asked By: Interview Candidate | Asked On: Sep 2nd, 2005

Answered by: pradeep on: Jan 8th, 2012

normal cursors do have a return type. ex:

Code
  1. CREATE package pkg_test IS
  2. cursor c1 RETURN emp%rowtype;
  3. end pkg_test;
  4.  
  5. CREATE package body pkg_test IS
  6. cursor c1 RETURN emp%rowtype IS SELECT * FROM emp WHERE empno = 10;
  7. begin
  8. FOR emp_cv IN c1 loop
  9. ..
  10. end pkg_test;
  11.  

Answered by: karthick on: Sep 17th, 2011

in cursor we can use same sql statements multiple times.
ref cursor we can use multiple sql statements.

How to display 4th maximum sal in enp without using subqueries?

Asked By: suresh | Asked On: Mar 28th, 2007

Answered by: Shiyamala Devi on: Jan 5th, 2012

Code
  1.  SELECT *
  2.         FROM (SELECT player_nm, gross_sal,
  3.                RANK () OVER (ORDER BY gross_sal DESC) playerRank
  4.               FROM player)
  5.         WHERE playerRank = 4;

This query will display 4th highest salary from the player table

Answered by: sunshine60india on: Jun 18th, 2011

SELECT TOP 1 * FROM
(
    SELECT TOP 4 * FROM EMPLOYEE ORDER BY CTC desc
)A
ORDER BY CTC

What is the difference between procedure and function and package, which is the fastest

Asked By: Suyog | Asked On: Apr 28th, 2006

Answered by: Kiran Shelar on: Dec 29th, 2011

Hi Everybody, I dont see much update on why package is more faster than function or procedure. Of corse package is must faster than procedure or function The reason being whenvever package is called f...

Answered by: selvaspak on: Dec 28th, 2010

Procedure may or may not return one or more value'sFunction must Return a valueFunction can use in the SQL query while procedure can't thats the major Difference between procedure and functionPackage ...

What is meant by DBMS_output.Put_line

Asked By: maheshwari | Asked On: Nov 7th, 2005

Answered by: aravinthancse on: Dec 27th, 2011

DBMS_OUTPUT - is a Oracle supplied package. put_line() is a DBMS_OUTPUT packages inbuilt procedure. put_line() is a combination of two inbuilt procedures such as put() and new_line(). procedure put()...

Answered by: dbxplorer on: May 30th, 2011

DBMS_OUTPUT is a Package and PUT_LINE is a Procedure.

PUT_LINE procedure places an entire line of into the buffer and that line is automatically followed  by the end-of-line marker i.e new line.

SQL statements syntax

Asked By: SAUMYA SRIVASTAVA | Asked On: Oct 23rd, 2011

How to display all rows and all the columns of employee table?

Debug procedure

Asked By: av_t66 | Asked On: Jan 7th, 2008

How to debug a procedure in SQL prompt

Answered by: srimanta sahoo on: Oct 4th, 2011

You can debug the procedure by writting following command :
alter procedure procedure name
debug ;

Answered by: puneet.kush on: Apr 17th, 2008

You can debug the procedure. Oracle gives a util programme DBMS_DEBUG by which you can debug a procedure.the full detail you can see at http://www.oracleutilities.com/wiki/index.php?title=Dbms_debugan...

How to insert data from one table to another table without insert command and cursors

Asked By: mandlakarna | Asked On: Feb 23rd, 2007

Answered by: Neeraj yadav on: Oct 3rd, 2011

Code
  1. SELECT   *  INTO
  2. tablename_2 FROM tablename_1

OR can pass clause also........................

Code
  1. SELECT   *  INTO
  2. tablename_2 FROM tablename_1
  3. WHERE  VNO='CV/2011/12'

Answered by: gsmanvi on: Jun 27th, 2008

declarecursor cursor_name isselect col1,col2,col3from tab_name;ab_record cursor_name%rowtype;beginopen cursor_name;loopfetch ab_record into cursor_name;exit when cursor_name%notfound;insert into tab_n...

What is ref cursor in PL/SQL?

Asked By: sandip_kate | Asked On: Mar 10th, 2006

Answered by: Sahaja Mallarapu on: Aug 26th, 2011

A Ref Cursor is a variable that points to cursor.A ref cursor allows you to store the result of a "bulk collect" from a table (or any PL/SQL cursor return set) into a PL/SQL table and then reference ...

Answered by: Sadashiv on: Aug 8th, 2011

REF Cursor OR Dynamic Cursors: Query associated with cursor is not known at the time of compilation. The select statement associated with cursor is changing at the time of running the program Syntax...

Hi guys,i have an interview question. Can anyone help me reg this.I have a table called "phone" and filed as "phone number" and table have values like 2489078905,2345678909now I want the result as (248)9078905,(234)5678909...

Asked By: dev | Asked On: Oct 20th, 2006

Answered by: SURESHMALLIPEDDI on: Aug 9th, 2011

select '('||substr(phone,1,3)||')'||substr(phone,4) "formated phone number",phone from phone

Answered by: paresh Borad on: Aug 1st, 2011

Use this query

create table newphone as (select '(' || substr(phnumber, 1,3) || ')' || substr(phnumber,4,10) "phonenumber" from oldphone)

Composite variables

Asked By: kantri | Asked On: Dec 6th, 2008

What are composite variable?

Answered by: Rams on: Aug 6th, 2011

A composite variable has internal components, which you can access individually. You can pass entire composite variables to subprograms as parameters. PL/SQL has two kinds of composite variables, coll...

Answered by: agitatedsoul10 on: Aug 4th, 2010

A Variable holds a value in a memory location. The Association of a variable to other variables can be called as composite variables.

First | Prev | | Next | Last Page

 

 

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Career Counselling

 Have Career Question?

 Ask Chandra

 Ask Only Career questions.

Follow us:
 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, click "Subscribe".