Re: Can i use the bind variable inside a procedure ?
|
Potthaccio Vaavaacione |
|
1/17/2008 2:08:52 AM |
Hi, If you want to pass 3 different values ,why using loop. directly execute three different SQL statme nts. Post Comments |
|
Re: Is there any provision...?
|
Poutt Keitis |
|
1/17/2008 2:13:51 AM |
No oththacci, Is there any provision to get different input from user for every time i enter the loop and dipslay the new value. example Code: ( text ) - declare
-
eno number(4);
-
begin -
for i in 1..5 -
loop -
eno:=&eno;
-
dbms_output.put_line(eno);
-
end loop;
-
end;
here i give an input 1 , but thats taken granted for all 5 times and it displays 1 1 1 1 1 but i want to give 5 differnet numbers each time i enter the loop. p lease help me to know whether this is possible or not Post Comments |
|
Re: No, that is not possible...
|
Konjanja Takeuchi |
|
1/17/2008 2:23:17 AM |
No, that is not possible unless you make use of 5 different variables. Alternative could be to use start and end value as an input parameter. Say you want employees whose empno is between 1 and 8 then you can use this code as shown below:
Code: ( oracle8 ) SQL> ed Wrote FILE afiedt.buf 1 DECLARE 2 TYPE empdet IS TABLE OF emp%ROWTYPE; 3 empd empdet; 4 eno NUMBER(4); 5 eno1 NUMBER; 6 BEGIN 7
eno:=&1; 8
eno1:=&2; 9 SELECT * BULK COLLECT INTO empd FROM emp WHERE empno BETWEEN eno AND eno1; 10 FOR I IN 1..empd.COUNT LOOP 11 DBMS_OUTPUT.PUT_LINE(empd(i).empno||','||empd(i).e name); 12 END LOOP; 13* END; SQL> / Enter VALUE FOR 1: 1 old 7:
eno:=&1; NEW 7:
eno:=1; Enter VALUE FOR 2: 2 old 8:
eno1:=&2; NEW 8:
eno1:=2; 1,AAAA 2,AAAA PL/SQL PROCEDURE successfully completed.
Post Comments |
|
Thanks a lot for the reply sir Post Comments |
|
You are welcome Pouttu. Post Comments |
|