Subject | Re: [firebird-support] for..do statement help |
---|---|
Author | Helen Borrie |
Post date | 2008-08-21T14:55:57Z |
At 05:12 21/08/2008, you wrote:
You can do that task via DSQL with a simple DDL statement:
INSERT INTO tbl_job_card_employee
(job_card_id,
employee_id,
commission)
select job_card_id, employee_id, employee_commission FROM tbl_job_card
./heLen
>HiYou have syntax errors there but in any case, PSQL is there to make hard tasks simpler, not to make simple tasks harder!
>
>I am trying to iterate through records in the tbl_job_card table and
>insert the values retrieved from the select statement and insert them
>into another table called tbl_job_card_employee. My statement follows
>
>BEGIN
>for select job_card_id, employee_id, employee_commission FROM tbl_job_card
>into :job_card, :employee, :comm DO
>INSERT INTO tbl_job_card_employee
>(job_card_id,
>employee_id,
>commission)
>VALUES
>(job_card,
>employee,
>comm);
>SUSPEND;
>END
>
>I get an error on job_card on line 4
>I would also like to run this statement directly (i.e. not a
>procedure), is this possible?
>
>Any help with this statement would be greatly appreciated.
You can do that task via DSQL with a simple DDL statement:
INSERT INTO tbl_job_card_employee
(job_card_id,
employee_id,
commission)
select job_card_id, employee_id, employee_commission FROM tbl_job_card
./heLen