SQL PLSQL Interview Questions
Questions Answers Views Company eMail

source destination distance chennai bangalore 500 bangalore chennai 500 hyd delhi 1000 delhi hyd 1000 bangalore hyd 800 Here chennai to bangalore and bangalore to chennai is same distance. and hyd and delhi also same criteria. Based on the distance i want to display only one row using sql query?

JPMorgan Chase,

4 11204

While inserting/updating million of records into a database table, how do I came to know how many records has been inserted or updated successfully so far?

HSBC,

2 7503

How to fetch records from a partitioned table?

HSBC,

2 7354

How many triggers can be implemented for a table?

HSBC,

3 6458

My select statement is not working as expected, So, to overcome from such issues what are the steps needed to be taken care?

CG,

2 4031

I have a table with 1 million records out of which 10,000 records are of unique records, then if I will implement index, then which type of index shall I use and why shall I use?

HSBC,

2 7049

Can we use commit or rollback in trigger? If yes, then how. Please explain with a suitable example?

HSBC,

5 12573

How to generate a salary slip like jan 1000 1000 feb 1000 2000 ... dec 1000 12000

BT,

1928

How to convert lowercase letters to uppercase and uppercase letters to lowercase in a string. (ex, AbcdEfG should convert as aBCDeFg)

TCS,

3 6467

I want to execute a piece of code before calling a procedure. How to achieve it?

Oracle,

1 3814

There are 5 records in a table and we have implemented two triggers that are :pre_query and post_query how many times these triggers will fire.

Maruti Suzuki,

2 3920

table name: prod there are three fields in the table that are 1.proddate 2.prodQty 3.model Day wise prodQty is stored in the table prod write a query to display total prodqty in the year 2004 april.

Maruti Suzuki,

2 3407

table name :Tab fields name 1.trx_no (pk) 2.trx_date 3.account code (7 char) 4.account type (1 char) 5.amt Tab contains account code day wise debit and credit transaction , account type fiels can have 2 value D for debit and c for Credit . write a query to display the account code wise total debit and credit bal for the month of april 2004. write a query to display account code wise new amt credit for the april 2004

Maruti Suzuki,

2 3567

Hi Guys, I have a situation where I need to access the column values from rowtype variable. However, the column names are dynamic. below is sample code: declare Cursor c1 is select * from emp; Cursor c2 is select column_name from xyztable; v_c2 c2%rowtype; v_str varchar2 v_value varchar2(200); begin for rec in c1 loop open c2;---this cursor has column names like EMPLOYEE_ID, FIRST_NAME, LAST_NAME etc. loop fetch c2 into v_c2; exit when c2%notfound; /* now lets say i want to access value of LAST_NAME from cursor c1, so I am writing below code, however it does not work as expected */ v_str:= 'rec.'|| v_c2.column_name; -- this will give me string like "rec.EMPLOYEE_ID" v_value:=v_str; end loop; end loop; end; / Plz help ASAP.Thanks.

2 3148

difference between SQL and C

Indus Software Technologies,

1 3081


Post New SQL PLSQL Questions

Un-Answered Questions { SQL PLSQL }

What are different methods to trace the pl/sql code?

790


What is your daily office routine?

2017


What are the syntax and use of the coalesce function?

825


What is keys and its types?

816


What is sql query limit?

739


how to decrement dates by 1 in mysql? : Sql dba

801


What are the advantages of normalization?

845


How do I view stored procedures?

769


how to use myisamchk to check or repair myisam tables? : Sql dba

754


What is the use of prepared statement?

782


How to return an array from java to pl/sql?

849


Does mysql support pl sql?

871


How does an execution block start and end in pl sql?

725


What is a database? Explain

872


Table1: Col1 col2 1 2 10 3 4 89 5 6 Table:2 Col1 col2 3 2 9 5 4 7 6 87 With the help of table1 and table2 write a query to simulate the fallowing results. Output1: Col1 col2 1 2 2 3 3 4 4 5 5 6 Output2: Col1 col2 2 3 10 4 5 89 6 7 1.Write query for single row to multiple row using sql statements. Eg:a,b,c,d,e,f Change to A B C D E F 2. Write query for multiple row to single row using sql statements. Eg2 A B C D E F Change to Eg:a,b,c,d,e,f Table1: Col1 col2 8 5 2 9 4 2 5 1.Write a query to select all the rows from a table1,if the value of A is null then corresponding B’s value should be printed in A’s value.if the value of A is null in that table then corresponding B’s value should be printed as 30. 2. write a query to find the sum of A and B .display the max among both. 3.write a query to find total number of rows from table 1. Note: if any column value is null in a row then that row should be considered as 2 rows. 4.write a query to display all the records of table1 except A containg 2 as well B containg 5. 5.rewrite the fallowing without using join and group by. Select b.title,max(bc.returneddate –bc.checkoutdate)” mostdaysout” From bookshelf_checkout bc, Book shelf B Where bc.title(+)=b.title Group by b.title. 6.rewrite fallowing query Select id_category from category_master X where exists (select 1 from sub_category Y where X.id_category=Y.id_category) Customer: Name phone1 phone2 phone3 bitwise A 23456 67890 12345 --- B 67459 89760 37689 --- Don’t_call Col1 67890 37689 1.q) update the customer table of bitwise with 1 or 0. Exists in don’t_call table menas show -1 Other wise -0. Output. Name bitwise A 010 B 010

2248