1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Create variables by concatening in loop and find out value

Discussion in 'SQL PL/SQL' started by BILLAL HUSSAIN, Jan 20, 2009.

  1. BILLAL HUSSAIN

    BILLAL HUSSAIN Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    Please look my variables like org1='12333', org2='46666' org3='4066'

    declare
    yy number default 0;
    xx number default 0;
    begin

    loop
    xx=xx+1;
    yy:='org'||xx;
    yy:=yy+2


    exit when xx=3;
    end loop;

    my new partner i am new member of your club. Iam only new person relation of oracle above my problem that yy variables doesn't give me org1,org2 org2 value like '12333' , '46666' ,'4066'
     
  2. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455
    Hi, I am no sql expert but yy is a number and you are trying to assign org1 which is a character to a number.
     
  3. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Tell us

    what exactly you are trying to do ?
    Where did yoy declared variables org1, org2 ,org3 ?

    Also some syntactical issues in your code .

    Adding Charcter to Number data type yy (as mentioned by sadik)
    Assignment operator is given as '=' for some statement instead of ':='
    Semi column (';') is missing for some statements.


    If you are trying to create variable like org1 ,org2 etc...
    you are wrong .

    org1 is Variable
    'org1' is value assigned to variable
     
  4. simply_dba

    simply_dba Forum Advisor

    Messages:
    95
    Likes Received:
    5
    Trophy Points:
    140
    Location:
    Kolkata, India
    You cannot use variables dynamically to assign it's value to another variable (If that is what you are trying to do, if I understand you correctly)
    You'll have to use pl/sql tables/arrays

    An example:
     
  5. BILLAL HUSSAIN

    BILLAL HUSSAIN Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    HELLO SADIK

    I am very happy to find your solution.
    actually I want thats what you are sent. I paid thanks.

    ................billal hussain.

    Now i want get backup by form builder. like i press push button
    then bakcup will be complete if it probable.
    please give a solution.
     
  6. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455

    Sorry brother but i don't understand what you are talking about.
     
  7. BILLAL HUSSAIN

    BILLAL HUSSAIN Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    Sorry brother

    actually i want to export and import file from oracle by form builder.

    like i press a push button then export will be done.

    plese replied.

    thank you
    ....................billal