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?

This is filtering certain rows for the given condition in the where clause and placing it in a table structure p_RtsReasons which is sent back to the calling procedure as a parameter.



Copying just takes time and space. Why do that? The better way is to run the query in ADO and use the recordset to go to one row at a time.
 
Vote for this answer ::  
RE: Can you explain for me this code?

Try Google
 
Vote for this answer ::  
RE: Can you explain for me this code?

i dont know that kind of code
 
Vote for this answer ::  
RE: Can you explain for me this code?

Well, it looks to me like the code is selecting data that meets the "WHERE" criteria from a table or view called "parlgene", then inserting that data into a table called "t_RtsReasons". I'm not sure if this code would work or not, because I have never coded a statement like this. But if it does, it's prett cool.
 
Vote for this answer ::  
RE: Can you explain for me this code?

sorry but i m not awear of this type of code
 
Vote for this answer ::  
Update Alert Setting