sqlplus

getting syntax error at line 34 : `<<' unmatched in ksh script

社会主义新天地 提交于 2019-12-12 20:25:16
问题 I have a shell script, when I execute it, I get the error syntax error at line 34 : `<<' unmatched in ksh script column_name=`sqlplus -s $BASE_DB_CONN<<!! WHENEVER SQLERROR exit ROLLBACK set SQLPROMPT '' set heading off set pagesize 1000 set linesize 5000 set feedback off set define on set verify off @smm9_stream_map.sql $STREAM_NAME $FIELD_NAME" exit !!`; To my surprise the same thing works in the while loop altered script as below while [ $a -lt ${NO_LOOP} ] do column_name=`sqlplus -s $BASE

How do I Open a Stored Procedure and Edit it in SQL*Plus

假装没事ソ 提交于 2019-12-12 20:16:24
问题 I need to make some changes to an old Oracle stored procedure on an obsolete box that is being kept around to run an old legacy process. The only tool I can connect to the db with is SQL Plus. How do I load a stored proc into memory for editing in SQL Plus? The tutorials I've found on-line don't exlain how that's done. :-( 回答1: It would be a lot easier to download the trial version of TOAD scratch that previous suggestion, I just tried out the Oracle SQL Developer link suggested and it works

Shell script to email results of SQLPlus query using Mailx in AIX

倾然丶 夕夏残阳落幕 提交于 2019-12-12 18:00:52
问题 I have the commands that I need. If I execute these commands at the prompt, everything works as expected. SQLPlus runs the query, exports the result to a file and then Mailx emails that file to me. sqlplus username/pwd@instance SPOOL /home/sadmin/sqlmail/spool.out set linesize 2000 set wrap off @/home/sadmin/sqlmail/query.sql SPOOL OFF exit mail -s "Subject" email@address.com < /home/sadmin/sqlmail/spool.out But, I can not, for the life of me, figure out how to put these in an .sh file so

in bash, heredoc inside function returns syntax error

谁说我不能喝 提交于 2019-12-12 15:46:36
问题 I have the following function: #!/bin/bash get_instance{ dbname=$(sqlplus -s / as sysdba<<EOF set pages 0 set feedback off select name from v\$database; exit; EOF) echo $dbname } get_instance It seems to work. In the middle of the error message, I get my dbname , but still returns a syntax error. oracle@testdb01:db01:/home/oracle/ > ./test.sh ./test.sh: line 3: get_instance{: command not found DB01 ./test.sh: line 11: syntax error near unexpected token `}' ./test.sh: line 11: `}' If I remove

PLSQL: Possible to use BOOLEAN datatype in SQLPLUS? [duplicate]

徘徊边缘 提交于 2019-12-12 14:52:39
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to use BOOLEAN type in SELECT statement I have tried running SQLPLUS on functions I've written which return the BOOLEAN data type. Is there any way to run these BOOLEAN functions from SQLPLUS? It seems that the BOOLEAN data type is not accessible at all from SQLPLUS. EDIT: I should have mentioned I was only working with SQLPLUS bind variables, not the standard DECLARE... PLSQL variables. 回答1: The BOOLEAN

What is the use of TNS_ADMIN variable in Oracle?

一世执手 提交于 2019-12-12 12:13:59
问题 Please tell me what is the use of TNS_ADMIN parameter in Oracle? I am working on Unix using oracle database. Is this parameter is required to locate the sqlplus. I am executing a script in which a update query is executed on Oracle Database. The script fails with 127 error code when executed with crontab. The script contents I suspect (eval) failing are ---------- cmd='sqlplus ${ORALOGIN} < SQLS ---------- eval $cmd 回答1: TNS_ADMIN tells sqlplus where to find the tnsnames.ora file. If you are

I need to call another sql file within an sql file using sql plus

萝らか妹 提交于 2019-12-12 10:22:41
问题 I need to call another sql file within an sql file using sql plus. This si the script i have so far and its not working. I have to code it in a unix vi file. I am new to this so would someone mind helping. thank you in advance. call=`$LIVE_SQL/sqlfile2.sql` if &call = 0 then echo "ERROR: $LIVE_SQL/sqlfile2.sql file not found" exit 1 fi 回答1: The command to call other SQL files from within SQLPLUS is : start (or @) Getting feedback from the SQL script : SQLPLUS is not Bash. It is possible, but

How to check the privileges (DDL,DML,DCL) on objects assigned to Schema, Roles in oracle Database?

倖福魔咒の 提交于 2019-12-12 08:59:32
问题 Most of the time we struggle with silly things to get the detail of privileges on Schema, Role and their Objects and try to find some easy way to get all the detail about it along with there pseudo queries code to generate grant statements in bulk for further execution. So here we are to get it. 回答1: A little brief about data dictionary view prefix: ALL_ -Describes PUBLIC Object grants. USER_ -Describes current user Object grants. DBA_ -Describes all object grants in the database. Useful

Error when run Oracle database sample schema script

大城市里の小女人 提交于 2019-12-12 05:59:48
问题 (I asked this question: SP2-0606: Cannot create SPOOL file , but I still stucked.) I am using Oracle 12c Release 2 on Windows 10 pro x64. Oracle installed at folder E:\app\summer\ . This is my tnsnames.ora # tnsnames.ora Network Configuration File: E:\app\summer\product\12.1.0\dbhome_1\network\admin\tnsnames.ora # Generated by Oracle configuration tools. ORACLR_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) (CONNECT_DATA = (SID = CLRExtProc)

Command line SQL invalid credentials

本秂侑毒 提交于 2019-12-12 05:26:33
问题 How can I make the USERNAME, PASSWORD and DATABASENAME INPUT reappear when I input invalid values or when the SQL did not connect? After the above image, the COMMAND LINE will just close. This is the batch(.bat) file. @echo off sqlplus /nolog @C:\Users\myuser\Desktop\conn.sql ECHO About to exit. timeout t/ 30 :pause And this is the conn.sql file conn &&username@&&DBNAME SPOOL C:\Sample.log SELECT 1 FROM DUAL / SPOOL OFF EXIT 回答1: According to Oracle 11g – SQLPlus Command Line Options and