Home » SQL & PL/SQL » SQL & PL/SQL » how to evaluate sting in if statment
how to evaluate sting in if statment [message #331886] Sun, 06 July 2008 07:57 Go to next message
RAY_HT
Messages: 153
Registered: May 2005
Location: Giza
Senior Member

dear all

i have table including the condition to evaluate data while entering
i generate string variable for this conndition but i want to pass the string to IF statment to be evaluated . like


declare
cursor chk_tab_cur is
select distinct 'x'
from fast_send a
where upper(a.tablename) = upper('fesal');
v_chk char(1);

cursor cond_cur is
select C.andor||' '||C.columnname||' '||C.operationsign||' '||C.valuelist STR
from fast_send b, FASTSEND_CONDITIONS C
where b.recid = C.fastsend_recid
AND B.tablename = 'FESAL'
ORDER BY B.recid;

V_COND VARCHAR2(200);
begin
open chk_tab_cur ;
fetch chk_tab_cur into v_chk;
close chk_tab_cur ;

if v_chk is not null then
FOR COND_REC IN COND_CUR LOOP
V_COND:= V_COND||' '||COND_REC.STR;
END LOOP;
DBMS_OUTPUT.PUT_LINE(V_COND);
END IF;

IF v_cond= v_cond THEN :NEW.SEND_DLAG:=1 ;
END IF;



END;

but when compile i get the error
expression is of wrong type

any advise ?? it's urgent

thanks
Re: how to evaluate sting in if statment [message #331887 is a reply to message #331886] Sun, 06 July 2008 08:00 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter).
Copy and paste the SQL*Plus session.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: how to evaluate sting in if statment [message #331889 is a reply to message #331886] Sun, 06 July 2008 08:03 Go to previous messageGo to next message
RAY_HT
Messages: 153
Registered: May 2005
Location: Giza
Senior Member

thanks for advice .

oracle 10g R2 .

any suggession .

Re: how to evaluate sting in if statment [message #331894 is a reply to message #331889] Sun, 06 July 2008 09:00 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
any suggession .

Quote:
Copy and paste the SQL*Plus session.

Regards
Michel
Re: how to evaluate sting in if statment [message #331923 is a reply to message #331886] Sun, 06 July 2008 11:55 Go to previous messageGo to next message
RAY_HT
Messages: 153
Registered: May 2005
Location: Giza
Senior Member

in a simple way

i'm writing trigger in oracle 10g r2 .

i have variable v_cond = ' :NEW.BRANCH_ID = 2 And :NEW.COMMENTS is Null'


then i want to check if this condition is true or false by writing ..

IF v_cond
THEN
:NEW.send_dlag := 1;
END IF;

but compilation error occured
expression is wrong type .

is there any way to pass this condition to if statment ??

thanks
Re: how to evaluate sting in if statment [message #331924 is a reply to message #331886] Sun, 06 July 2008 12:02 Go to previous messageGo to next message
BlackSwan
Messages: 25036
Registered: January 2009
Location: SoCal
Senior Member
Please read & follow Posting Guidelines below
http://www.orafaq.com/forum/t/88153/0/
Re: how to evaluate sting in if statment [message #331925 is a reply to message #331923] Sun, 06 July 2008 12:07 Go to previous messageGo to next message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What don't you understand in my post:
Michel Cadot wrote on Sun, 06 July 2008 15:00
please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter).
Copy and paste the SQL*Plus session.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel


Re: how to evaluate sting in if statment [message #331927 is a reply to message #331923] Sun, 06 July 2008 12:14 Go to previous message
Frank
Messages: 7880
Registered: March 2000
Senior Member
RAY_HT wrote on Sun, 06 July 2008 18:55
is there any way to pass this condition to if statment ??


Do you really need this in a row-trigger? It might be easier to do in an after statement trigger, since you would then be able to do a (dynamic) select on the table.
To keep trace of the rows that need to be checked, use the framework that is used to circumvent the mutating table error.
Previous Topic: is there anyway to get the 10g|11g DBMS_CRYPTO stuff for 9i?
Next Topic: Help? Arithmetic operation of columns of different table
Goto Forum:
  


Current Time: Sun Dec 04 06:49:31 CST 2016

Total time taken to generate the page: 0.04668 seconds