Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Need help to solve the problem.

Need help to solve the problem.

From: Violin <violin.hsiao_at_mail.pouchen.com.tw>
Date: 12 Jun 1999 01:17:52 GMT
Message-ID: <3762fa44.6283923@news.twsc.pouchen.com.tw>


Hello,
I have 2 tables like this:

TAB1                                     TAB2
---------------------------           --------------------------------- 
YYMM   CHAR(6)              YYMMDD    CHAR(8) 
DAY1     CHAR(1)            
DAY2     CHAR(1)
DAY3     CHAR(1)
DAY4     CHAR(1)
DAY5     CHAR(1)
 :::::::::         
DAY29   CHAR(1)

DAY30 CHAR(1)
DAY31 CHAR(1) Maybe the table was not designed well.......But it's hard to change now.

And I want to create a trigger :
CREATE TRIGGER INS_TAB1 AFTER INSERT ON TAB1 FOR EACH ROW DECLARE

                   CursorID         integer;
                   select_stmt    varchar2(100); 
                   Processed    integer;
BEGIN
              CursorID := dbms_sql.open_cursor;
              select_stmt := 'SELECT YYMMDD FROM TAB2 WHERE YYMMDD = :x';

              FOR i IN 1..31
              LOOP
                         dbms_sql.parse(CursorID,select_stmt,dbms_sql.v7);
                         dbms_sql.bind_variable( CursorID , ':x' , :NEW.DAYi ); 

===> Here is my trouble,how to get the :new.day1~31
Processed := dbms_sql.execute(CursorID); IF dbms_sql.fetch_rows(CursorID) = 0 THEN /* Trigger script */ END IF; END LOOP;

END;
/

If you have any idea,please tell me and I'll appreciate it . Thank you in advance.

Violin.
violin.hsiao_at_mail.pouchen.com.tw Received on Fri Jun 11 1999 - 20:17:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US