help in this Procedure Parameters [message #389568] |
Mon, 02 March 2009 12:19 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amr_wafa
Messages: 9 Registered: January 2009
|
Junior Member |
|
|
hello all..check this procedure
PROCEDURE QUERY1(c1 VARCHAR2,s1 VARCHAR2) IS
CURSOR emp_curs IS SELECT * FROM emp WHERE c1 LIKE '%' || s1 || '%';
BEGIN
GO_BLOCK('EMP');
CLEAR_BLOCK(NO_COMMIT);
FIRST_RECORD;
FOR i IN emp_curs LOOP
:empno := i.empno;
:ename := i.ename;
:job := i.job;
:mgr := i.mgr;
:sal := i.sal;
:comm := NVL(i.comm,0);
:emp.deptno := i.deptno;
DOWN;
END LOOP;
END;
and in a when-button-pressed trigger :
query1('ename',:txtitem_name)
its not working i dont know why ...i think you know what i want to do now....so is this possible or theres another way to do this....
thanks all..
[Updated on: Mon, 02 March 2009 12:46] Report message to a moderator
|
|
|
|
|
Re: help in this Procedure Parameters [message #389597 is a reply to message #389568] |
Mon, 02 March 2009 20:20 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
amr_wafa wrote on Mon, 02 March 2009 19:19 | its not working i dont know why ...
|
"Is not working" is not Oracle error message nor reasonable description of any possible problem. Please be more specific.
amr_wafa wrote on Mon, 02 March 2009 19:19 | i think you know what i want to do now....so is this possible or theres another way to do this....
|
To do what? Compare two string parameters (not depending on table content) in LOOP? I see no for doing that; but, as you did not post the requirements, it is just place for guesses, what is this procedure supposed to do.
|
|
|
|
Re: help in this Procedure Parameters [message #389737 is a reply to message #389568] |
Tue, 03 March 2009 07:28 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
amr_wafa
Messages: 9 Registered: January 2009
|
Junior Member |
|
|
i want to use exact the same cursor in multiple forms with different column name and condition so i made that procedure.
and there are no FRM or ORCL errors occurring...but its not working right.
can someone guide me where to read about it ... i cant find a material or something..thanks
|
|
|
|
|
|
|
|
Re: help in this Procedure Parameters [message #394186 is a reply to message #389568] |
Thu, 26 March 2009 00:29 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
As far as I know, dynamic cursor is possible to use only in PL/SQL procedure, not the Forms one. You can create PL/SQL procedure inside DB which returns the cursor based on dynamic query.
But, as you already fetch columns inside the FOR LOOP statically, it is questionable why the compared column name shall be "dynamic" and (as all compared columns are already known) you do not use statical comparison, something like CASE LOWER(c1)
WHEN 'ename' THEN ename
WHEN 'job' THEN job
<etc. for all possible c1 values>
END LIKE '%' || s1 || '%' (not sure about correct Forms syntax).
Even if you would like to compare non-string (DATE, NUMBER) columns, you could convert its values into string explicitly in this static version and do not rely on implicit conversion.
|
|
|
|