Subject | cursors in sp?? |
---|---|
Author | Regina Phandu |
Post date | 2002-10-03T09:18:51Z |
Hi,
I'm pretty new to Firebird.
Now, I have problems in creating store procedures. Is cursors allowed in SP?
Can I use Declare Cursor, Open cursor, Fetch, and Close cursor??
I'm trying to substract the quantity of a product after there were
transactions.
table product:
prod_code | qty
1 | 10
2 | 20
3 | 30
4 | 40
table transaction:
prod_code | qty
1 | 2
3 | 4
1 | 3
so, the results of the quantity should be:
prod_code | qty
1 | 5
2 | 20
3 | 26
4 | 40
since there were no transaction for prod_code 2 and 4, so..the quantity
remains the same.
Problems:
1. I need 0 quantity to prod_code 2 and 4. I need 0 not 'null' value.
2. I guess I need cursors to do this. But so far I didn't success creating
cursors in my procedures.
Can anyone please help me?
Thx!
Regina Phandu
I'm pretty new to Firebird.
Now, I have problems in creating store procedures. Is cursors allowed in SP?
Can I use Declare Cursor, Open cursor, Fetch, and Close cursor??
I'm trying to substract the quantity of a product after there were
transactions.
table product:
prod_code | qty
1 | 10
2 | 20
3 | 30
4 | 40
table transaction:
prod_code | qty
1 | 2
3 | 4
1 | 3
so, the results of the quantity should be:
prod_code | qty
1 | 5
2 | 20
3 | 26
4 | 40
since there were no transaction for prod_code 2 and 4, so..the quantity
remains the same.
Problems:
1. I need 0 quantity to prod_code 2 and 4. I need 0 not 'null' value.
2. I guess I need cursors to do this. But so far I didn't success creating
cursors in my procedures.
Can anyone please help me?
Thx!
Regina Phandu