DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Procedure compile Problems

  1. #1
    Join Date
    Aug 2000
    Posts
    68

    Procedure compile Problems

    -- Trying to Do
    I am just trying to get the cursor principle to work , so all I am trying to do is take each item_number from the dock 3 table, get its commodity code from the
    table2 and update the commodity field in the dock3 table



    -- Code.

    PROCEDURE sp_update_dock3
    ( v_item_number in varchar )

    AS
    begin

    declare
    cursor dock3_item is
    select distinct(item_number) from dock3;

    for dock3_item_record in dock3_item loop
    fetch dock3_item into v_item_number;

    update dock3
    set commodity = (select attribute9
    from Table2
    where segment1 = v_item_number
    and organization_id = '57')

    end loop;

    end;

    Any advice & suggestions are appreciatated.
    Carpe Diem

  2. #2
    Join Date
    Feb 2003
    Location
    Pak
    Posts
    64
    Orignal Post:

    [B]PROCEDURE sp_update_dock3
    ( v_item_number in varchar )

    AS
    begin

    declare
    cursor dock3_item is
    select distinct(item_number) from dock3;
    [B]

    After seeing your code, i found an error.
    you can not declare the Cursor or any other type of variable in a procedure after "Begin section".


    Try this

    PROCEDURE sp_update_dock3
    ( v_item_number in varchar )
    AS

    cursor dock3_item is
    select distinct(item_number) from dock3;


    begin
    ----------- Here is your code.
    end;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width