sqlplus

Why is SET DEFINE OFF not working for the colon (:) character?

穿精又带淫゛_ 提交于 2019-12-12 05:14:10
问题 I have a script I'm trying to run via sqlplus. At the top of the script, I have "SET DEFINE OFF" set. However, when I run it, I'm receiving this error: SP2-0552: Bind variable "CHANDAWALA" not declared. I believe this is happening because I have a couple update statements that include colons within a string like this: UPDATE ADDRESS SET ADDRESS_STREET_LINE1 = 'Moh: Chandawala'... UPDATE ADDRESS SET ADDRESS_STREET_LINE1 = 'Moh:chandawala'... So it's treating them like bind variables. I was

Sqlplus - Export and spool result

孤街醉人 提交于 2019-12-12 04:38:24
问题 I am using shell script to execute an export in sqlplus Spool: SET echo off SET linesize 32767 SET LONG 1000 SET LONGCHUNKSIZE 1000 SET wrap off SET heading off SET colsep ';' SET pagesize 0 SET feed off SET termout off SET trimspool off SELECT AUTO_SEQ.nextval as ROW_ID, .. .. And the result: 29419987;FOR_IMPORT;1000 ;KR 19 F 65 73 ;KR 19 F 65 73, 47001, 47000 ;SANTA MARTA ;Cargado por EIM en 03-MAY-17 ;KR 19 F 65 73, 47001, 47000 ;KR 19 F 65 73, 47001, 47000 ;KR 19 F 65 73, 47001, 47000

ORA-04021: timeout occurred while waiting to lock object

会有一股神秘感。 提交于 2019-12-12 04:26:22
问题 I have this anonymous PL/SQL block which calculates and prints a value return from a table. DECLARE U_ID NUMBER :=39; RETAIL BINARY_FLOAT:=1; FLAG NUMBER; BEGIN SELECT NVL(RETAIL_AMOUNT,1),UNIT_ID INTO RETAIL, FLAG FROM UNITS WHERE UNIT_ID=U_ID; LOOP SELECT NVL(MAX(UNIT_ID),U_ID) INTO FLAG FROM UNITS WHERE FATHER_ID=FLAG; IF FLAG=U_ID THEN EXIT; END IF; SELECT RETAIL* RETAIL_AMOUNT INTO RETAIL FROM UNITS WHERE UNIT_ID=FLAG; EXIT WHEN FLAG=U_ID; END LOOP; DBMS_OUTPUT.PUT_LINE( RETAIL); END;

oracle plsql if not found repeat

女生的网名这么多〃 提交于 2019-12-12 04:17:55
问题 set verify off accept project prompt ' project : ' select locknr,description,couserid,ciuserid from dgdtw_lockedinfo where description = '&project' and ciuserid is null; accept lock prompt ' locknumber : ' update dgdtw_lockedinfo set ciuserid = couserid where locknr = &lock; update dgdtw_topografie set locknr = '' where locknr = &lock; update dgdtw_topografie set verval=sysdate where id= &lock; commit; accept var prompt 'repeat process? [Y/N] ? ' define doit = 'H:\Scripts\stop.sql' column

SP2-0606: Cannot create SPOOL file

孤者浪人 提交于 2019-12-12 04:03:14
问题 I use Oracle 12c R2 on Windows 10 pro x64. I get sample script by cd E:\github.com\oracle git clone https://github.com/oracle/db-sample-schemas.git in CMD E:\github.com\oracle\db-sample-schemas\human_resources>sqlplus sys/summer as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed Jun 28 11:15:24 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, OLAP, Advanced

Vietnamese characters are garbled after import

孤街浪徒 提交于 2019-12-12 02:41:54
问题 I exported a table in Oracle (which has Vietnamese text) from Dataserver A: export NLS_LANG=AMERICAN_AMERICA.VN8VN3 exp system/123 BUFFER=64000 FILE=/tmp/export.dmp TABLES=(USERS.AREA) GRANTS=N INDEXES=NO ROWS=Y And then, I try to import export.dmp to Dataserver B: export NLS_LANG=AMERICAN_AMERICA.VN8VN3 imp system/123 BUFFER=64000 FILE=/tmp/export.dmp indexes=n grants=n constraints=n statistics=none ignore=y full=y But, the field ID_ISSUE_PLACE was garbled. And this is the screenshot which I

Sqlplus command is not working via plink

谁说我不能喝 提交于 2019-12-12 01:43:57
问题 I have a shell script in which I am using sqlplus command to fetch the data from database (Installed on Linux). same script is working fine on Linux environment. When I execute the script on window environment via using below batch file. set ORACLE_TERM=xterm set ORACLE_BASE=/home/pwcadm/app/pwcadm set ORACLE_HOME=/home/pwcadm/app/pwcadm/product/11.2.0/client_1 set ORACLE_HOSTNAME=kyora02.kymab.local set ORACLE_SID=orcl set ORA_NLS11=$ORACLE_HOME/nls/data set LANG=en_US.UTF-8 set PATH=/opt

Convert each character in a string to a row

三世轮回 提交于 2019-12-12 01:38:08
问题 I have a column which contains a String with numbers like '12345' (no separator or blanks) and I want to split this column to rows for each character: From: COLUMN ------------------ 12345 To: COLUMN ------------------ 1 2 3 4 5 This Should work in a single select so that I can use it like this: ... AND WHERE SOMECOLUMN NOT LIKE ( ... THE SELECT ... ) 回答1: with temp as (select '12456' as str from dual) select substr(str,level,1) from temp connect by level <= length(str); Result: 1 2 4 5 6 来源:

Passing variable user,pass,sid in sqlplus comman

两盒软妹~` 提交于 2019-12-11 19:26:37
问题 I want to pass variables in sqlplus command in my bash script, answer might be given but doesn't work for me. I tried some thing like this #!/bin/bash ssh oracle@10.116.12.26 <<XX echo Please enter an Oracle Username: read USERNAME echo "Please enter the Oracle Username's Password:" read -s PASS SID=XE export conn_str=$USERNAME/$PASS@$SID sqlplus $conn_str << EOF select * FROM tabs; exit EOF XX also tried sqlplus $USERNAME/$PASS@SID #with option -s and -l I also find solution like this but

Oracle: Script similar to describe command

二次信任 提交于 2019-12-11 18:56:06
问题 I'm being asked to create a script that basically does the same thing as the describe command. I have figured out how to write the script and get the output I want, but the second part of the assignment is to "duplicate the format of the describe command" I'm stumped, is there really a way to simply duplicate that format? 回答1: Assuming your query is something like (note that I'm not bothering to handle every different data type) select column_name "Name", (case when nullable = 'N' then 'NOT