RE: Use of host command from scripted SQL)++

  • From: "David Moss" <David.Moss@xxxxxxxxxxxx>
  • To: "Mladen Gogala" <mgogala@xxxxxxxxxxx>, <oracle-l@xxxxxxxxxxxxx>
  • Date: Sat, 16 Dec 2006 10:20:54 -0000

Mladen,

I thought the very idea behind PL/SQL was to put procedural functionality 
behind SQL... and I do understand your point and respect it, but I'm fairly new 
to Oracle scriptting, I come from a 'proper' programming background and my 
first instincts when comfronted with a new toy is to look for its boundaries, 
limitations and see how far can it go. None of the stuff Im doing at the moment 
are going to be deployed anywhere (my SQL itself is probaby very bad too), 
however I'm trying to find these things ou first so I know whatt can be done 
and what is just plain impossible, and on the way any other relevant bits of 
knowledge. As an example, one of the first things I tried was getting user 
input from the command line into a procedure. It took me about a whole day to 
realize people were actually right in that it cannot be done, reason being that 
the procedures get compiled and run in the server which is completely separated 
from any input mechanism. This is a very good thing to know (not the fact that 
the user can't give input but thatt the way the code is run doesn't impact on 
what it does)

David.

PS Sorry for the double t's (my keyboard is repeating... not good when youre 
programming lol)


-----Original Message-----
From: Mladen Gogala [mailto:mgogala@xxxxxxxxxxx]
Sent: Fri 12/15/2006 11:21 PM
To: David Moss; oracle-l@xxxxxxxxxxxxx
Subject: RE: Use of host command from scripted SQL)++
 
That kind of code knitting is disgusting and detrimental to
the company which uses it.

Tools like sqlplus or bash are not meant for very smart
programming and scripting. Yes, one

can make a shell scrip and a .SQL file do things like you
described, but it's ugly, tricky and

platform dependent. Problems like the one you described
should be solved with a general

purpose scripting language like Perl or PHP. Some perverts
are even using something called

"Python" but that's very exotic and funky stuff, illegal in
some states.

In other words, shell and SQL*Plus programming, when applied
to complex problem is

not only bad spaghetti code but also a counterproductive
mess which is hard to maintain, 

debug or support. Scripting should be done in scripting
languages, that is why Larry Wall has 

given them to us.

 

  _____  

From: oracle-l-bounce@xxxxxxxxxxxxx
[mailto:oracle-l-bounce@xxxxxxxxxxxxx] On Behalf Of David
Moss
Sent: Friday, December 15, 2006 5:00 PM
To: David Moss; oracle-l@xxxxxxxxxxxxx
Subject: (RE: Use of host command from scripted SQL)++

 

Hi all

Firstt of all, I just wanted to thank you all for your help.

On a sidenote, does anyone know if you can stop the
execution of a script called using @ or @@ conditionally?
This has to be outside of a procedure as I'm using ACCEPT
and the like. Halting the sqlplus process is not an option
either. I'm trying to get a recursive script to work.

Think of something like

------some-file.sql--------
SOME CODE

ACCEPT some_var PROMPT 'Give me input> ';

IF some_var = '' THEN               -- I know this doesn't
exist
    COOL CODE TTHAT STOPS SCRIPT
END IF

PRINT some_var

MORE CODE

@@some-file.sql
-------/some-file.sql--------

David. 


This message is confidential and is intended for the
addressee only; unless clearly stated that this disclaimer
should not apply, this e-mail is not intended to create
legally binding commitments on behalf of FDM Group Plc, nor
do its contents reflect the corporate views or policies of
FDM. Any unauthorised disclosure, use or dissemination,
either whole or partial, is prohibited. If you are not the
intended recipient of the message, please notify the sender
immediately.
____________________________________________________________
____________
This e-mail has been scanned for all viruses by Star
Internet. The
service is powered by MessageLabs. For more information on a
proactive
anti-virus service working around the clock, around the
globe, visit:
http://www.star.net.uk
____________________________________________________________
____________



________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


This message is confidential and is intended for the addressee only; unless 
clearly stated that this disclaimer should not apply, this e-mail is not 
intended to create legally binding commitments on behalf of FDM Group Plc, nor 
do its contents reflect the corporate views or policies of FDM. Any 
unauthorised disclosure, use or dissemination, either whole or partial, is 
prohibited. If you are not the intended recipient of the message, please notify 
the sender immediately.
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Other related posts: