Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2009
    Posts
    58

    Unanswered: Pass a variable in a LIKE Query - Stored Procedure

    Hi Guys,

    I like to pass a variable value in a LIKE query.

    Code:
    spool /ora/dstage/DWEDW/Projects/Uniques/Logs/stats_edw_atg_order_bill_address_t.logg
    VARIABLE v_partition_name varchar2(32);
    VARIABLE v_test varchar2(32);
    VARIABLE v_test1 varchar2(32);
    
    BEGIN
      select  COL1  into     :v_partition_name
        from   Table1    where    d_day = trunc(sysdate);
    
    
     select '%'||:v_partition_name
       into :v_test
    from dual;
    
    
    select Target_col into :v_test1
    from table2 where KeyA like v_test;
    
    END;
    /
    print v_partition_name;
    print v_test;
    I need to take COL1 from Table1 and pull out Target_col corressponding to it whichever ends with COL1 value.
    The procedure is running fine for the first 2 queries but when i wrote the last one. It is throwing an error.

    Can somebody let me know what i am doing wrong.

    Cheers!!!!!

  2. #2
    Join Date
    Jul 2009
    Posts
    58
    Missed a Colon... (

    it should be
    Code:
    like :v_test1

  3. #3
    Join Date
    Jul 2009
    Posts
    58
    How to Close the thread???

Posting Permissions

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