sqlplus

Spool file is getting duplicates

泄露秘密 提交于 2020-01-25 14:18:55
问题 I have created the following Script ( name.sql ) which is then called from a windows.bat file. The problem is that the .xls file that is created has twice the resultset from the SQL query. I send you the script to help me udnerstnad what i do wrong in the .sql script: set linesize 999 verify off feedback off set markup html on entmap on spool on preformat off table 'align=right width=40% border=10 bordercolor=black bgcolor=white' set echo off pagesize 1000 linesize 255 feedback off heading on

How to make a menu in SQLPlus or PL/SQL?

喜你入骨 提交于 2020-01-21 14:36:52
问题 I am making this program that will have a menu that gets the user's input and performs a certain script based on his/her choice. Something along the lines of: Please make a selection: 1: Do script a 2: Do script b 3: Do script c I looked at this link : How to make SQLPlus or PL/SQL Menu And I was able to get something out of it, BUT it's not fully functional. Because there are certain lines I don't understand. See below. PROMPT 1: Make a sales invoice PROMPT 2: Inquire a sales invoice accept

ORA-12505, TNS:listener does not currently know of SID given in connect des

◇◆丶佛笑我妖孽 提交于 2020-01-20 04:23:26
问题 Please kindly help me as I just installed Oracle 11g but cannot connnect using SQL Devloper using the settings below: Username: system Password: mypassword Hostname: localhost Port: 1521 SID: XE Error message: Status : Failure -Test failed: Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor I checked on Windows Services: OracleServiceXE: Started OracleXETNSListener: Started I also unable to connect to

Parameterizing table name in sqlplus input file

邮差的信 提交于 2020-01-16 04:58:09
问题 I am trying to export some data using sqlplus and the Oracle spool functionality. The problem is that the SQL input file where I am defining my export is not letting me parameterize the table name from which I am exporting data -- it wants a literal :( Calling sqlplus in a shell script: sqlplus $USER/$PASSWD@$ORADB<<! @export.sql $OUT_FILE $SOME_VAR $ENV exit ! export.sql: set heading off set head off set term off set tab off set embedded on set feedback off set pagesize 0 set linesize 800

sql*plus is truncating the columns names according to the values in that columns

北战南征 提交于 2020-01-15 09:14:45
问题 I have two broad questions: Q1. Are executing the lines of code in Oracle SQL Developer and executing the same code in sqlplus command prompt same things? (reason I ask this that I heard that not all the sqlplus commands are executable in SQL Developer. If answer to above question is yes then please then few useful links will help) . Q2. I am spooling the results of a sql query to a .csv file, but the thing is that columns names are truncated according the maximum length of the values in that

Sqlplus oracle : How can I run sql command on bash in 1 line?

本秂侑毒 提交于 2020-01-14 07:20:14
问题 Can I convert this into 1 command line on bash in sqlplus? cause i want to automate it. sqlplus / as sysdba SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE); exit 回答1: You won't need the exit with automation because it should exit on end of file anyway. So on one line you could do: echo 'EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);' | sqlplus / as sysdba 回答2: sqlplus user/password@host @file.sql 回答3: you can wirite by follow in a shell #!/bin/bash sqlplus / as sysdba <<EOF EXEC DBMS_XDB

Hide SQL > statements in the spool file

喜夏-厌秋 提交于 2020-01-14 03:30:05
问题 I want to hide the "SQL> @test.sql" and "SQL> spool off" in the file test.txt(spool file) my steps set heading off set pages 0 set trimspool on set lines 120 set feedback off set echo off set termout off spool test.txt @test.sql spool off test.txt SQL> @test.sql 2002452199 2797 9/1/2014 9/30/2014 OO56128665 934 90087318 1 6046 10226342 ########## 0 0 SQL> spool off 回答1: reason for getting sql statements into results is:-     If you copy those sql scripts and paste directly on sql prompt,and

Is there a .Net interface to Oracle SQLPLUS?

荒凉一梦 提交于 2020-01-11 05:09:06
问题 I'm developing some automation to control the execution of SQL scripts. The scripts are run through SQL*PLUS and contain PL/SQL calls in them (hence I can't run them through ODP.NET ). I was wondering if there was a .NET interface to SQL*PLUS ? If so has anyone used it? 回答1: You can do it in C# with this piece of code: public int execString(string scriptFileName) { int exitCode; ProcessStartInfo processInfo; Process process; int timeout = 5000; processInfo = new ProcessStartInfo("sqlplus.exe"

RAISE_ APPLICATION_ ERROR--之异常处理

走远了吗. 提交于 2020-01-10 15:20:15
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 平时用来测试的异常处理 我们都是通过dbms_output.put_line来输出异常信息,但是在实际的应用中,需要把异常信息返回给调用的客户端。 其实 RAISE_APPLICATION_ERROR 是将应用程序专有的错误从服务器端转达到客户端应用程序(其他机器上的SQLPLUS或者其他前台开发语言) raise_application_error(异常类型,传递信息) 异常类型:number 值域:-20000 到-20999 传递信息:varchar2(2000) DBMS_STANDARD包的RAISE_APPLICATION_ERROR过程,可以重新定义异常错误消息,它为应用程序提供了一种与ORACLE交互的方法。语法如下 RAISE_APPLICATION_ERROR(errorNumber,errorString) errorNumber是数值在-20000到-20999之间,errorString为自定义的错误信息。 如: update jobs set job_title = v_newJobTitle where job_id = v_jobid; if sql%notfound then RAISE_APPLICATION_ERROR(-20167,'update failure!');

halt on compilation error in a sqlplus script

会有一股神秘感。 提交于 2020-01-10 06:09:07
问题 I am deploying pl/sql code using several sql files that are called with @@file . If a package got a compilation error the script continues to the end. Is there a way to stop on every compilation error? I tried WHENEVER SQLERROR EXIT SQL.SQLCODE but the script still continues. 回答1: No native sql*plus way I'm aware of. Only workarounds. Like this: 20:42:50 TEST@oars_sandbox> get scr 1 whenever sqlerror exit rollback 2 create or replace procedure my_failed_proc as 3 i number; 4 begin 5 select 1