Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2003
    Posts
    20

    Unanswered: Running Script from DBI with @ or START

    I run a script by manually logging into SQLPLUS. It works fine as follows:

    SQL> @/home/my_home/my_script.sql

    Note that I am giving the full path to the script.

    I am now trying to do the same via Perl. When I try to run the following command via DBI

    $sth = $dbh->prepare("START /home/my_home/my_script");
    $sth = $dbh->execute();

    I get ORA-00900 error for Statement Syntax

    I have tried the following as well:

    $sth = $dbh->prepare("\@ /home/my_home/my_script");
    $sth = $dbh->execute();


    $sth = $dbh->prepare(qq{START /home/my_home/my_script});
    $sth = $dbh->execute();


    $sth = $dbh->prepare(qq{@ /home/my_home/my_script});
    $sth = $dbh->execute();

    Nothing seem to work.

    Any idea on how to run the script from the DBI itself.

    I will appreciate any response and suggestions.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    AFAIK, your are mixing SQL*Plus syntax (@ & START) with Perl's DBI.
    They are NOT the same interface into the DB!
    I suspect the best you'll be able to do is to open the *SQL files and read them line by line before executing the results.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    AFAIK, your are mixing SQL*Plus syntax (@ & START) with Perl's DBI.
    They are NOT the same interface into the DB!
    I suspect the best you'll be able to do is to open the *SQL files and read them line by line before executing the results.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  4. #4
    Join Date
    Oct 2003
    Posts
    26
    You need to pass the sql in that file within quotes to prepare or read it into a scalar variable and pass it to prepare

    HTH
    Arvind

Posting Permissions

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