Interview Question in SQL Server Indexing


 

Interview Question :: Can you explain for me this code


This code is written in PL/SQL any one can give me brief description about it? any thoughts will be appreciated.

TYPE t_RtsReasons IS TABLE OF t_RtsReason INDEX BY BINARY_INTEGER;

PROCEDURE get_rts_reasons(p_Mag IN NUMBER, p_RtsReasons OUT t_RtsReasons) IS
CURSOR C IS
select
palcent,
pallibl
from
parlgene@tpx
where
palnmag=p_Mag and
palctab=30 and
palcent between 500 and 599 and
pallang=
(select
parlibc
from
pardgene@tpx
where
parnmag=palnmag and
parctab=726 and
parcent=1)

order by
palcent;

i NUMBER(9):=1;

BEGIN
FOR R IN C LOOP
p_RtsReasons(i):=R;
i:=i+1;
END LOOP;
END;
Answers to "Can you explain for me this code"
RE: Can you explain for me this code?

You are selecting the columns: palcent and pallibl from the table called parlgene using a where clause. One condition of the where clause uses a subselect from the pardgene table.



The program uses "cursors" and a loop to step through the table entries. This should simply select the indicated columns and store the returned data in the array.
 
Vote for this answer ::  
Update Alert Setting