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

Thread: Static variable in SQL

  1. #1
    Join Date
    Jan 2002
    Posts
    15

    Question

    Is it possible to have some kind of static variable in sql statements say....when a column = whatever u can append the value of another column in that row to the variable?

  2. #2
    Join Date
    Jun 2000
    Location
    Madrid, Spain
    Posts
    7,447
    dont understand what you really mean but I will try...

    Code:
    declare
      l_append_tab varchar2(100);
    begin
      for i in (select * from dba_tables
                where owner in ('LSC', 'TEST')
                order by owner, table_name)
      loop
        if i.owner = 'LSC'
        then
        l_append_tab := i.owner||'.'||i.table_name;
        dbms_output.put_line(l_append_tab);
        end if;
      end loop;
    end;
    /
    
    LSC.A
    LSC.A001
    LSC.A002
    LSC.A003
    LSC.B
    LSC.BONUS
    LSC.DEPT
    LSC.DUMMY
    LSC.EMP
    LSC.INVOICE
    LSC.LSCEMP
    LSC.SALGRADE
    
    PL/SQL procedure successfully completed.

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