If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Newbie ? Please Help!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-22-03, 09:32
zubby01 zubby01 is offline
Registered User
 
Join Date: Dec 2003
Posts: 3
Newbie ? Please Help!

I'm a little new at this and need some help. My assignment is to modify the following function and do the following steps:
1.If ab_Table.a_col = xy_Table.a_col, then dosomething.
??How do I populate xy_Table
??How does ab_Table get populated in the code below
??How do I compare the ab_Table.a_col to xy_Table.a_col to see if they match
??Where should the code go in the function

/*This is what already exists, I need to know where to put my code.*/
tbl_rc_ab_Table Number :=0

TYPE ab_Table_rectab IS TABLE OF ab_Table %ROWTYPE
INDEX BY BINARY INTEGER

tbl_ab_Table_rectab ab_Table_rectab;

FUNCTION fCreate(p_arg IN OUT...)
n NUMBER :=0
IF tbl_ab_Table_rectab.COUNT > 0 THEN
FOR n in 1..tbl_ab_Table_rectab.COUNT LOOP
IF tbl_ab_Table_rectab.cola = p_arg THEN
tbl_ab_Table_rectab.colb :=1
END IF;
END LOOP;
tbl_rc_ab_Table = tbl_ab_Table_rectab.COUNT + 1;
tbl_ab_Table_rectab(tbl_rc_ab_Table).col_c :=0
END IF:
Reply With Quote
  #2 (permalink)  
Old 12-22-03, 10:30
olerag olerag is offline
Registered User
 
Join Date: Aug 2003
Posts: 40
Answers to your questions:
Both #1 and #2 - populate a physical table with the INSERT statement.
#3 - Use the equivalence operator to test variables of same type.
#4 - Well, the "record group" you declare is only initialized (but no
values are being populated in it), the arg val ("p_arg) is of both IN OUT
(only IN is needed) and all this loop is doing right now is making
"colb" equal to a value of 1 if "cola" equals the "p_arg".

First, I think you'll need to place values into this RG (using a Cursor
from the table). Once the RG has values, now you'll be able to
get something out of it with your FOR loop.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On