Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2003
    Posts
    19

    Unanswered: Migrate Partial datas to oracle

    Hi,

    I have a problem. plz help me.
    I'm migrating database from sqlserver to oracle.
    Now i have to convert the queries to oracle, which are used to BUILD. These queries are executed as BATCH file.

    Query to be converted (IN SQLSERVER)
    ---------------------

    if not exists(select module_id from portal_module where module_id=0)
    begin
    insert into portal_module (module_name,module_id,customize) values ('Portal',0,0)
    end
    go

    ...........
    ............

    if not exists(select module_id from portal_module where module_id=14)
    begin
    insert into portal_module (module_name,module_id,customize) values ('Adminviews',14,0)
    end
    go
    ....
    .....


    i want this to be worked in oracle...For incerting the rocords.
    I'm not getting problem while convert 'if not exists' to oracle. Is there any alternative way to check ' IF NOT EXIST" in oracle.


    thks for advance.
    ARul.

  2. #2
    Join Date
    Sep 2003
    Location
    The Netherlands
    Posts
    311
    hi,

    try using a cursor to select the values for a given parameter.
    then the code would be like :

    open crs_a(parameter)
    fetch crs_a into rowtype;
    if crs_a%notfound
    then
    insert into table(columnlist)
    values( valueslist);
    end if;
    close crs_a;

    hope this helps
    Edwin van Hattem
    OCP DBA / System analyst

  3. #3
    Join Date
    Sep 2003
    Posts
    19
    thks...
    I'm executing this query in sql by clicking batch file.
    I can use 'cursor' in sql.
    Is there any query to execute in sql.

    thks,
    Arul.

    Originally posted by evanhattem
    hi,

    try using a cursor to select the values for a given parameter.
    then the code would be like :

    open crs_a(parameter)
    fetch crs_a into rowtype;
    if crs_a%notfound
    then
    insert into table(columnlist)
    values( valueslist);
    end if;
    close crs_a;

    hope this helps

  4. #4
    Join Date
    Sep 2003
    Posts
    19
    CORRECTION
    ----------------
    I'm executing this query in sql from batch file.
    I can NOT use 'cursor' in sql.
    Is there any query to execute in sql.

    thks,
    Arul

  5. #5
    Join Date
    Sep 2003
    Posts
    19
    Sorry...
    i got it....It's working...

    Arul
    Originally posted by arulprakash
    CORRECTION
    ----------------
    I'm executing this query in sql from batch file.
    I can NOT use 'cursor' in sql.
    Is there any query to execute in sql.

    thks,
    Arul

Posting Permissions

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