I need to deploy database objects by calling a script. But it throws an error like this "PLS-00103: Encountered the symbol "PROMPT" ".
What could be the problem with my script?
My script is as follows:
set echo on
spool logs/dm_ref.log
Prompt Running dw/deploy/dm_ref/file.sql...
#dw/deploy/dm_ref/file.sql
Prompt Running dw/deploy/dm_ref/file_tbl.sql...
#dw/deploy/dm_ref/file_tbl.sql
spool off
set echo off
the 2nd Prompt is for creating a table which successfully runs.
The problem is with the first Prompt for which it creates a stored procedure.
Thank's in advance.
The main issue is you're not giving us enough information to answer your question.
SQL Developer's script engine DOES support the PROMPT command.
Please amend your question to include the spooled output, the error message, and the contents of your .sql files you are executing.
Related
I am a beginner in SQL and was running a PL/SQL file in SQL plus command line however it is showing the message' "SP2-0103: Nothing in SQL buffer to run", and the output from the previous executed PL/SQL file is getting displayed followed by the correct output of the current file. Any suggestions on how to correct this?
I am going through SQL*Plus script and came across set of lines that has below lines:
#test_data/EMPLOYEE.dat
#test_data/ADDRESS.dat
The .dat has some SQL code inside them. I tried to search in internet what the # symbole indicates but I did not get any results. I am new to SQL*Plus, please let me know what this symbol indicates.
This is about sql*plus scripting, we use this symbol to call scripts from external files.
# is used to call scripts from the external files
From the Oracle docs:
Runs the SQL*Plus statements in the specified script. The script can
be called from the local file system or from a web server. The #
command functions similarly to ## and START.
It is used to run the scripts from another file. eg:
SQL> #PreImport.sql
I am using the below command in my Expect script file.
set name [StringToBytes "Tamin"];
puts "name = $name"
When i run this script, i get the below error.
invalid command name "StringToBytes"
while executing
"StringToBytes "Tamin""
invoked from within
"set name [StringToBytes "Tamin"]"
Can anyone please help me to fix this?
As far as I know, this means that the command StringToBytes could not be found. StringToBytes is not listed in the documentation, so presumably you intended to define this command yourself?
I have a problem with insertion scripts in SQL PLUS.In my insert scripts data contains '&' like this 'Rat&CAT'.When am run my script file using SQL PLUS Batch file .It is always promting this message "Enter the Value of CAT:".Could any one tell me how to solve this problem?
Add this command at the start of your script:
SET DEFINE OFF;
It will turn off variable substitution.
I have the following batch script:
sqlplus ms/ms#orcl < drop.sql
sqlplus ms/ms#orcl < create.1.0.sql
This works fine when I double click on the bat file in Windows Explorer and run it.
But when I type the command name from the DOS prompt I get an error:
C:\>create.bat
C:\>sqlplus ms/ms#orcl 0<drop.sql
The handle is invalid.
C:\>sqlplus ms/ms#orcl 0<create.1.0.sql
The handle is invalid
Any ideas?
Update: Made the change to use # instead of <. This gets around the error but now the script only executes the first file and then leaves you at the SQL> prompt. To get the second file to execute you have to type exit at the prompt, then the second file runs. Not sure how to get both files to execute. ??
If you want SQL*PLUS to execute a script, a better way than command-line redirection is the # syntax:
sqlplus ms/ms#orcl #drop.sql
sqlplus ms/ms#orcl #create.1.0.sql
Also read up on the ## syntax, which you can use to execute a .sql script from another .sql script in the same directory.
SQL> help #
SQL> help ##
Made the change to use # instead of <.
This gets around the error but now the
script only executes the first file
and then leaves you at the SQL>
prompt. To get the second file to
execute you have to type exit at the
prompt, then the second file runs. Not
sure how to get both files to execute.
??
I ended up writing a python script to run sql plus and then exit it to get around this issue. I have yet to find any way around that limitation. Although you would only have to deal with the issue once if you use ## as was suggested. You would just have to run the second script from the first script.