in reply to Re: EOF problem with sqlplus on Windows
in thread EOF problem with sqlplus on Windows

Maybe you intended to have the HERE document being interpreted by the shell, but this doesn't work either, because passing a multi-line string to qx does not cause the shell to execute a multi-line script.
Couldn't bother to try?
$ export PS2=""; perl -E '$x = `cat <<FOO hello world FOO`; print uc $x' HELLO WORLD $
qx doesn't filter out newlines, and the shell is smart enough to know how to deal with newlines.

Replies are listed 'Best First'.
Re^3: EOF problem with sqlplus on Windows
by rovf (Priest) on Mar 22, 2012 at 14:27 UTC
    Couldn't bother to try?
    At that time, I only had access to a Windoze system, where I tried it of course (as you can see from my posting). Thanks for demonstrating that this is different on *nix.

    -- 
    Ronald Fischer <ynnor@mm.st>
Re^3: EOF problem with sqlplus on Windows
by theophanie77 (Novice) on Mar 23, 2012 at 15:22 UTC
    JavaFan, It still does not work. But we tried with a colleague to execute sqlplus with the "<<" on the server itself. The same error occurs : "<< etait inattendu" ( << was unexpected ) We need to search the way to execute multiple sqlplus commands at the windows prompt now. Thanks Jean-michel
      I never claimed it would work. In fact, it seems you have a Windows shell problem. I've never worked on Windows, don't care about the platform, and never will work on Windows. I don't have any suggestions how to solve your problem (well, except upgrading to something useful, like VMS or a Unix flavour or even Linux)

      What I did point out was that the "problem" isn't caused by qx not able to deal with newlines. It can. If the shell you're using cannot deal with multi-line statements, get a better shell. If your shell does not understand here documents, don't send a here document to it. This is not a Perl problem.

      What shell does your server run?
      YES !!! ( thanks to http://damir-vadas.blogspot.fr/2010/11/how-to-redirect-sqlplus-result-in.html ) We thus made it this way :
      $my_sql="select sysdate from dual"; my $request="echo $my_sql\|sqlplus system/password"; $result=qx($request);
      Thanks for your help Jean-michel