Subject | Re: [firebird-support] for..do statement help |
---|---|
Author | Alexandre Benson Smith |
Post date | 2008-08-20T19:21:45Z |
dinol.softedge wrote:
try this:
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);
END
INSERT INTO
tbl_job_card_employee
(job_card_id, employee_id, commission)
select
job_card_id, employee_id, employee_commission
FROM
tbl_job_card
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
> Himissing collons.
>
> 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
>
try this:
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);
END
> I would also like to run this statement directly (i.e. not ayes
> procedure), is this possible?
>
INSERT INTO
tbl_job_card_employee
(job_card_id, employee_id, commission)
select
job_card_id, employee_id, employee_commission
FROM
tbl_job_card
> Any help with this statement would be greatly appreciated.see you !
> Thanks in advance
>
>
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br