Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Location
    Missouri, USA
    Posts
    18

    Unhappy Unanswered: bad bind variables

    In Oracle, I have a PL/SQL procedure that is called from a module in Designer 6i. It's a simple one: insertextent(id,:CGU$USER);

    Then the insertextent procedure is:

    BEGIN
    INSERT INTO pig_cells(PIG_ID, CELL_ID_NMBR)
    SELECT id, EXTENT_ID
    FROM EXTENT_LIST
    WHERE
    USER_NAME = user_id;
    EXCEPTION
    WHEN NO_DATA_FOUND then
    NULL;
    END;

    The table EXTENT_LIST only has 2 columns (USER_NAME and EXTENT_ID).

    My problem is that I'm getting PL/SQL ERROR 49: bad bind variable 'CGU$USER'. I tried replacing the 'CGU$USER' with 'x', but still got the error. Can anyone help me with this bad bind variable? Thanks much, Margaret

  2. #2
    Join Date
    Jul 2003
    Posts
    2,296
    you need a declare section which you specify what type and how
    many variables you are passing into the proc.

    I always like to specify my variables with a 'v_' so they are
    easy to detect in the proc.

    I think this would be better personally.

    PHP Code:
    create or replace procedure insertextent
    (v_id         varchar2,
     
    v_user_id varchar2
    )
    IS

    v_extent extent_list
    .extend_id%rowtype;

    BEGIN

    select extent_id
    into v_extent
    from extent_list
    where user_name 
    v_user_id;

    INSERT INTO pig_cells
    (PIG_ID
     
    CELL_ID_NMBR)
    VALUES (
     
    v_id,
     
    v_entent);

    END;

    add any exception you want to wherever ...
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

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