- What's the difference between SQL, DDL, and DML?
- What's a join? An inner join? An outer join?
- Describe HTTP.
- What's a design pattern?
- Can you explain the singleton, vistor, facade, or handle class design pattern?
- When you do an ls -l, describe in detail everything that comes up on the screen.
- Tell me three ways to find an IP address on a Unix box.
- Write a bubble sort.
- Write a linked list.
- Describe an object.
- What does object-oriented mean to you.
- Can you explain what a B tree is?
- What's the difference between UDP and TCP?
- What is ICMP?
- What's the difference between a stack and a Queue?
- Do you know anything about the protection rings in the PC architecture?
- How much hardware/Assembler/Computer Architecture experience do you have.
- Explain final, finalize, and finally. When the finalize is invoked? How does GC work? etc.
- What is your experience with Servlet and JSP?
- What is the Prototype design pattern?
- In a system that you are designing and developing, a lot of small changes are expected to be committed at the end of a method call (persisted to the DB). If you don't want to query the database frequently. what would you do?
- Give an example in which you will combine several design patterns, and explain how the system can benefit from that.
- Why would you apply design patterns (benefits)?
- What is a two-phase commit?
- What will happen if one of your web-server or appserver crashs during its execution?
- What are various problems unique to distributed databases
- Describe the file system layout in the UNIX OS
- what is disk interleaving
- why is disk interleaving adopted
- given a new disk, how do you determine which interleaving is the best
- give 1000 read operations with each kind of interleaving determine the best interleaving from the statistics
- draw the graph with performace on one axis and 'n' on another, where 'n' in the 'n' in n-way disk interleaving. (a tricky question, should be answered carefully)
- Design a memory management scheme.
- What sort of technique you would use to update a set of files over a network, where a server contains the master copy.
Showing posts with label How we can implement Ref Cursors in SQL?. Show all posts
Showing posts with label How we can implement Ref Cursors in SQL?. Show all posts
Design pattern HTTP OOP SQL Interview Questions
Design pattern HTTP OOP SQL Interview Questions
How we can implement Ref Cursors in SQL?
How we can implement Ref Cursors in SQL?
create or replace procedure my_procedure ( p_ename in varchar2 default NULL,
p_hiredate in date default NULL,
p_sal in number default NULL)
as
type rc is REF CURSOR;
l_cursor rc;
l_query varchar2(512)
default 'select * from emp where 1 = 1 ';
cursor l_template is select * from emp;
l_rec l_template%rowtype;
begin
if ( p_ename is NOT NULL ) then
dbms_session.set_context( 'MY_CTX', 'ENAME',
'%'||upper(p_ename)||'%');
l_query := l_query ||
' and ename like
sys_context( ''MY_CTX'', ''ENAME'' ) ';
end if;
if ( p_hiredate is NOT NULL ) then
dbms_session.set_context( 'MY_CTX', 'HIREDATE',
to_char(p_hiredate,'yyyymmddhh24miss'));
l_query := l_query ||
' and hiredate >
to_date(
sys_context( ''MY_CTX'',
''HIREDATE'' ),
''yyyymmddhh24miss'') ';
end if;
if ( p_sal is NOT NULL ) then
dbms_session.set_context( 'MY_CTX', 'SAL', p_sal);
l_query := l_query ||
' and sal >
to_number(
sys_context( ''MY_CTX'',
''SAL'' )
) ';
end if;
dbms_output.put_line(l_query);
p( l_query );
open l_cursor for l_query;
loop
fetch l_cursor into l_rec;
exit when l_cursor%notfound;
dbms_output.put_line( l_rec.ename || ',' ||
l_rec.hiredate || ',' ||
l_rec.sal );
end loop;
close l_cursor;
end;
/
create or replace procedure my_procedure ( p_ename in varchar2 default NULL,
p_hiredate in date default NULL,
p_sal in number default NULL)
as
type rc is REF CURSOR;
l_cursor rc;
l_query varchar2(512)
default 'select * from emp where 1 = 1 ';
cursor l_template is select * from emp;
l_rec l_template%rowtype;
begin
if ( p_ename is NOT NULL ) then
dbms_session.set_context( 'MY_CTX', 'ENAME',
'%'||upper(p_ename)||'%');
l_query := l_query ||
' and ename like
sys_context( ''MY_CTX'', ''ENAME'' ) ';
end if;
if ( p_hiredate is NOT NULL ) then
dbms_session.set_context( 'MY_CTX', 'HIREDATE',
to_char(p_hiredate,'yyyymmddhh24miss'));
l_query := l_query ||
' and hiredate >
to_date(
sys_context( ''MY_CTX'',
''HIREDATE'' ),
''yyyymmddhh24miss'') ';
end if;
if ( p_sal is NOT NULL ) then
dbms_session.set_context( 'MY_CTX', 'SAL', p_sal);
l_query := l_query ||
' and sal >
to_number(
sys_context( ''MY_CTX'',
''SAL'' )
) ';
end if;
dbms_output.put_line(l_query);
p( l_query );
open l_cursor for l_query;
loop
fetch l_cursor into l_rec;
exit when l_cursor%notfound;
dbms_output.put_line( l_rec.ename || ',' ||
l_rec.hiredate || ',' ||
l_rec.sal );
end loop;
close l_cursor;
end;
/
Subscribe to:
Posts (Atom)