ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories >> Software >> Databases >> Oracle >> Oracle-General
 
 


 

Back to Questions Page
 
Question
If a table column has is UNIQUE and has NOT NULL, is it 
equivalent to a PRIMARY KEY column?
Rank Answer Posted By  
 Question Submitted By :: Maruthi
This Interview Question Asked @   IBM , Ibm
I also faced this Question!!   © ALL Interview .com
Answer
No. It can be at table level, but this will get failed 
while referencing in another table.
 
0
Yuva
 
 
Question
What is cursor
Rank Answer Posted By  
 Question Submitted By :: Sagar Joshi
This Interview Question Asked @   TCS
I also faced this Question!!   © ALL Interview .com
Answer
A cursor is a SELECT statement that is defined within the 
declaration section of your PLSQL code. We'll take a look 
at three different syntaxes for cursors.

Cursor without parameters (simplest)
The basic syntax for a cursor without parameters is:

CURSOR cursor_name
IS
    SELECT_statement;



For example, you could define a cursor called c1 as below.

CURSOR c1
IS
    SELECT course_number
      from courses_tbl
      where course_name = name_in;

The result set of this cursor is all course_numbers whose 
course_name matches the variable called name_in.



Below is a function that uses this cursor.

CREATE OR REPLACE Function FindCourse
   ( name_in IN varchar2 )
   RETURN number
IS
    cnumber number;

    CURSOR c1
    IS
       SELECT course_number
        from courses_tbl
        where course_name = name_in;

BEGIN

open c1;
fetch c1 into cnumber;

if c1%notfound then
     cnumber := 9999;
end if;

close c1;

RETURN cnumber;

END;
 
0
Ramdeep Garg
 
 
Question
If I have a select statment which retrives 2 rows, & that 
rows have the same data in all the fields except the last 
field and I want to merge the 2 rows to be in 1 row with 
concatenating the last field which have the different 
data.... eg:  the 1st row has these fields: A-B-C 
the second row has: A-B-X ........ i want to merge the two 
row to be in one row like ----> A- B- C,X
Rank Answer Posted By  
 Question Submitted By :: Meldo
I also faced this Question!!   © ALL Interview .com
Answer
Try this...Hope this will give the Required Answer
create table testsamp(a char,b char,c char);
insert into testsamp values ('A','B','C');
insert into testsamp values ('A','B','X');

select a,b,c from(
 select a , b,
 c||lead(c,1) over (partition by a,b order by a,b) c from 
testsamp ) tmp where rownum=1;

Regards,
Murali
 
0
Murali Mohan
 
 
 
Question
One Table having two rows with one colomn having values 
Like"Male" and "Female". how to upadte these values 
Like "Female" and "Male" in single update statement.
Rank Answer Posted By  
 Question Submitted By :: Swamy
This Interview Question Asked @   Polaris
I also faced this Question!!   © ALL Interview .com
Answer
Try this,


update testsamp1 set c=decode
(c,'MALE','FEMALE','FEMALE','MALE');


Regards,
Murali
 
0
Murali Mohan
 
 
Question
how to select alphabets in a one column , for this the 
table name is PA_TASKS and column name is TASK_NUMBER, In 
TASK_NUMBER the data like this 
1.1.3NN,1.1.4NN,1.5.1NN,1.3.2NE,1.5NN,1NN,1.2NE,1CE , For 
this i need to disply output as only NN,but not other 
alphabets, if NN is thre means i should display , otherwise 
leave that blank or empty  Its some urgent 
requirement ,thanks in advance
Rank Answer Posted By  
 Question Submitted By :: Surendra Babu Yadav
I also faced this Question!!   © ALL Interview .com
Answer
SELECT CASE WHEN instr(TASK_NUMBER,'NN')>0 THEN 'NN' ELSE 
null END FROM PA_TASKS;
 
0
Reddibasha
 
 
Question
what is query and types of query
Rank Answer Posted By  
 Question Submitted By :: Guest
This Interview Question Asked @   Reliance
I also faced this Question!!   © ALL Interview .com
Answer
to retrieve data from the database tables is called query
 
0
Manohar
 
 
Answer
A Query is a SELECT statement, which is always successful.
 
0
Reddibasha
 
 
Question
difference between imlicit cursor and explicit cursor ?
Rank Answer Posted By  
 Question Submitted By :: Nagireddyunix
This Interview Question Asked @   Cap-Gemini
I also faced this Question!!   © ALL Interview .com
Answer
Implicit : Every SQL Statement performed as implicit cursor. Ex: Select * from Emp where empno = 7839 This is query automatically open the cursor and fetch the record getting the output of that record.

Explicit : In PLSql Block in we declare on declaration section we declare with name and select statement. In executable block we call the cursor and fetch the records more the one. For Ex : Declare
cursor c1 is select * from emp
getemp c1%rowtype;
begin
open c1;
loop
fetch c1 into getemp;
dbms_output.put_line (c1.col list);
end loop;
close c1;
end;  This is explicit cursor
 
0
Vsubbaiah
 
 
Question
how to delete all duplicate records from a table using 
subquery?
Rank Answer Posted By  
 Question Submitted By :: Nagireddyunix
This Interview Question Asked @   Cap-Gemini
I also faced this Question!!   © ALL Interview .com
Answer
delete from abc where rowid not in (select max(rowid) from
abc group by column_name_with_dup.values.);
 
0
Maninder
 
 
Answer
delete from emp e1 where rowid >(select min(rowid) from emp 
e2 where e1.empid=e2.empid)
 
0
Dharmendra
[Self]
 
 
Answer
delete from 
<<table_name>>
where rowid in 
(select a.rowid
from <<table_name a,table_name b>>
where a.colname = b.colname
b.colname2 = b.colname2
......
...
a.colnamen = colnamen
order by .... desired colnames)
 
0
Edara Satish
[Self]
 
 
Question
Is primary key = unique key,not null?
If yes,please explain
IF No,please explain
Rank Answer Posted By  
 Question Submitted By :: Prashant Pradhan
I also faced this Question!!   © ALL Interview .com
Answer
Primary key and unique are Entity integrity constraints

Primary key allows each row in a table to be uniquely 
identified and ensures that no duplicate rows exist and no 
null values are entered.

Unique key constraint is used to prevent the duplication of 
key values within the rows of a table and allow null 
values. (In oracle, one null is not equal to another null).
 
0
Anamika Niit
 
 
Answer
More or less both the keys sounds same, but the major 
diffrence is where unique will allow null values, because 
each null treated as a diffrent value internally. Incase of 
primary key it will not allow any repeated data and null 
data.

 
0
Edara Satish
 
 
Answer
Yes.When a column is assigned primary key it means it 
contains unique value(i.e. no duplicate value is allowed) & 
it can't accept null values.
  Whereas unique key means no duplicare value is allowed, but
null value is allowed. And not null means no null value is
accepted but duplicate value can be passed.
 So when we assign primary key to a column, the column
becomes both unique & not null.
 
0
Kirti
 
 
Question
what r tyhe major differences between oracle 9i & 10g?
Rank Answer Posted By  
 Question Submitted By :: Debasis
I also faced this Question!!   © ALL Interview .com
Answer
oracle 10g has introduced data pump,awr addm etc
 
0
Sonali
 
 
Answer
oracle 10g has many features compare to 9i like
asm,swr,addm,flaskback recovery,data pump..
generating snap shot is much more flxible in 10 g compare to 9i
 
0
Krishna
 
 
Question
Hello All,

Could any one provide me FAQs/interview questions on 
oracle PL/SQL
Rank Answer Posted By  
 Question Submitted By :: Suneelreddy
I also faced this Question!!   © ALL Interview .com
Answer
Plese see thin link: http://www.orafaq.com/wiki/PL/SQL_FAQ
 
0
Krishna
 
 
 
Back to Questions Page
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com