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

Thread: A very simple question

  1. #1
    Join Date
    Jan 2001
    Posts
    216
    A very simple question

    I have a main .sql file from which I call a couple of other .sql files

    example

    setup_main.sql
    @setup_one
    @setup_two
    @setup_three

    so, during our system installation, we just run setup_main.sql. That takes care of all other setups.

    Now, my question is, I have some variables that are used in some setup scripts. Is there a way by which I can initialze those variables in setup_main.sql itself and pass them as arguments to the other setup scripts ? Otherwise, the person installing the sofware has to go to each of the setup scripts and change them. I am trying to avoid that.

    So, I want my setup_main.sql to look like:

    setup_main.sql
    @setup_one host_name
    @setup_two user_name
    @setup_three

    I was thinking may be I have to create stored procedures for sqls to access input variables. Is there a better way ?

    Thanks




  2. #2
    Join Date
    Jan 2001
    Posts
    26

    Wink

    Hmmm.

    Yes. You may initialize some variables in main.sql and pass
    them as a parameter in all the subsequent sqls. What you may
    have to do in all the subsequent sqls is put a reference to these variables by using them as &var1, &var2 etc.

    Then, when u are invoking these setup_one, setup_two sqls, invoke them as :
    @setup_one var1 var2
    @setup_two var1 var2

    That should do it.

    Ofcourse, you can write PL/SQL procedures also.

    Happy coding !!!

  3. #3
    Join Date
    Jan 2001
    Posts
    216
    Works great !

    Thankyou. You saved me a lot of time !

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