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 -> Re: Need help to solve the problem.

Re: Need help to solve the problem.

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Sat, 12 Jun 1999 15:53:12 GMT
Message-ID: <3767822f.5018686@newshost.us.oracle.com>


A copy of this was sent to violin.hsiao_at_mail.pouchen.com.tw (Violin) (if that email address didn't require changing) On 12 Jun 1999 01:17:52 GMT, you wrote:

>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;
>/
>

you cannot dynamically access the :new/:old records passed to a trigger.

Instead of showing the logic you would like to code -- can you tell us what you are trying to do -- we may be able to suggest a way to do that.

>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

See http://www.oracle.com/ideveloper/ for my column 'Digging-in to Oracle8i'... Mirrored (and more current) at http://govt.us.oracle.com/~tkyte/

Current article is "Fine Grained Access Control", added June 8'th  

Thomas Kyte                   tkyte_at_us.oracle.com
Oracle Service Industries     Reston, VA   USA
--
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Sat Jun 12 1999 - 10:53:12 CDT

Original text of this message

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