Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Can't code for s.... peanuts
How
about trying to pass the variable you are using in the Cursor to the
Cursor:
<FONT face=Arial color=#0000ff
size=2>
<FONT
color=#000000>CURSOR c_namestbl (p_name_to_check in
varchar2) ISSELECT lnameFROM
namesWHERE lname = p_name_to_check;
<FONT
color=#000000>Then open the cursor with the variable.
<FONT
color=#000000>
OPEN
c_namestbl(p_name_to_check);
<FONT
color=#000000>
<FONT face=Tahoma
size=2>-----Original Message-----From:
oqij4ngfcrweuh001_at_sneakemail.com
[mailto:oqij4ngfcrweuh001_at_sneakemail.com]Sent: Monday, July 23,
2001 1:27 PMTo: Multiple recipients of list
ORACLE-LSubject: Can't code for s.... peanuts
Hi again everybody,
I'll try to be as descriptive as possible, sorry
if I leave anything important out.
I have the following function which I'm compiling
using PL/SQL Developer (tnx Djordje).
CREATE OR REPLACE FUNCTION check_for_name
(p_name_to_check VARCHAR)RETURN BOOLEAN
ISCURSOR c_namestbl ISSELECT
lnameFROM namesWHERE lname =
p_name_to_check;v_return_value
BOOLEAN;BEGINOPEN c_namestbl;IF
c_namestbl%NOTFOUND THENv_return_value :=
FALSE;ELSIF C_namestbl%FOUND
THENv_return_value := TRUE; END
IF;RETURN v_return_value;CLOSE
c_namestbl;END check_for_name;
It compiles without errors (now).
The table 'names' is built like this :
SVRMGR> DESCRIBE names;Column
Name Null? Type------------------------------ -------- ----FNAME VARCHAR2(20)LNAMEVARCHAR2(20)SVRMGR>
LNAME-------------------- --------------------Bruce WillisSalma HayekTom CruiseElle
Received on Mon Jul 23 2001 - 15:30:08 CDT
![]() |
![]() |