Re: [Q] SQL calls from UNIX scripts?
Date: 8 Jun 1994 12:20:47 GMT
Message-ID: <2t4d2v$2e3_at_meaddata.meaddata.com>
see end
In article <2t3rn4$2ms_at_netserver.univ-lille1.fr>, noel_at_omega.univ-lille1.fr (Yves Noel) writes:
|>
|> In article <Cr1n8x.1Ips_at_ief.itg.ti.com>, rlscott_at_lobby.ti.com (Raymond Scott) writes:
|> |>We have both Sybase and Oracle installed on an
|> |>HP 9000 running HP-UX. I would like to be able
|> |>to execute SQL from a UNIX script. The goal is
|> |>to be able to create 'quicky' transactions to
|> |>perform frequently done SQL etc.
|> |>
|> |>Is this possible? How do I do this?
|> |>TIA
|> |
|> Very easy to do, below the type of script I use every days. In a file you put :
|>
|> cat > temp.sql << EOF
|> .
|> .
|> . you SQL, SQL*Plus, PL/SQL commands
|> .
|> .
|> / <-- to execute
|> exit <-- to go out
|> EOF <-- the end of the script
|> sqlplus -s / _at_temp.sql <-- execution under SQL*Plus
|> rm -f temp.sql <-- if you want to remove temp.sql
or another way... (for Sybase-- should be pretty much the same for Oracle)
#!/bin/sh
SYBASE=/path/to/sybase/home/directory
$SYBASE/bin/isql -Uuserid -Ppassword <<EOF
use foo
go
select * from bar
go
(or something more useful, perhaps? :) )
EOF
|>
|> Don't forget to put execution privilege on the file that contains these lines.
|> Hope this help.
|> --
|> Yves NOEL ______________________________________________ C.I.T.I. (batiment M4)
|> Database Administrator ________________ Universite des Sciences et Technologies
|> Email: Yves.Noel_at_univ-lille1.fr ________ 59655 Villeneuve d'Ascq Cedex - FRANCE
|> Voice: (33) 20.33.70.74 _________________________________ Fax: (33) 20.43.66.25
|>
|> I use ORACLE v6.0.36 on DEC RISC ULTRIX v4.3
|> ___
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Terry Miesse | Any resemblance between the above views Mead Data Central | and those of my employer, my terminal, ... I work here, but I'm | or the view out my window are purely not really sure where | coincidental. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Keep your nose to the grindstone. It sharpens your boogers." -- Steven Tyler (Aerosmith)Received on Wed Jun 08 1994 - 14:20:47 CEST