LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Shell script to run pl/sql script. (https://www.linuxquestions.org/questions/linux-general-1/shell-script-to-run-pl-sql-script-228497/)

colly 09-09-2004 04:37 AM

Shell script to run pl/sql script.
 
Hi,
I would seriously apperciate an answer to these questions. Please Help.

I am using a shell script which starts SQLPlus and runs a file with pl/sql in it.
Should my pl/sql file have a sql or a pl extension.
When exiting sql to use perl do I use similar tags to php such as
<?php ...code... ?> or do I use anything.

Will the SQLPlus reject the script if it has a pl extension or will the perl not work if it has an sql extension?

Please help if anybody knows answer to any of these questions.
Thanks,
Colm.

Hangdog42 09-09-2004 06:49 AM

Unlike Windows, Linux doesn't use extensions to control function. So a perl script can be .pl, .c, .sql or nothing at all. What is important is that the script have permission to execute (see man chmod if you need help here) and that the first line point to the perl interpreter. So you will usually see the first line have something like:

#! /usr/bin/perl

That indicates that the script needs to be interpreted by perl. Now if you want to use extensions so that you know what the file is, go ahead. It just doesn't make any difference to how the program is run. The same will go for SQLPlus. I can't imagine that it gives a hoot what extenstion the file has as long as the contents are SQL.

Quote:

When exiting sql to use perl do I use similar tags to php such as
You're going to have to do some serious reading here. Usually I do things the other way around, I have a perl program running that then executes SQL code. I'm not sure that SQLplus has the ability to escape, run a perl program, then return to running SQL, however I may be wrong about that.


All times are GMT -5. The time now is 03:01 PM.