sqlplus

halt on compilation error in a sqlplus script

点点圈 提交于 2020-01-10 06:07:32
问题 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

oracle SQL plus how to end command in SQL file?

这一生的挚爱 提交于 2020-01-09 07:44:36
问题 I have SQL file with few commands. What it the correct way to end lines in the script? Is it slash [/] semicolon [;] both? Is there any diffarent between regular sqls and Stored procedure code? Thank you 回答1: For normal SQL statements, either a / on a line by itself, or a ; at the end of the command, will work fine. For statements that include PL/SQL code, such as CREATE FUNCTION , CREATE PROCEDURE , CREATE PACKAGE , CREATE TYPE , or anonymous blocks ( DECLARE / BEGIN / END ), a ; will not

Return value from sql script to shell script

穿精又带淫゛_ 提交于 2020-01-09 07:36:13
问题 I have shell script that calls the following sql script: INSERT INTO SEMANTIC.COUNT_STATISTICS (...); UPDATE SEMANTIC.COUNT_STATISTICS SET PRNCT_CHANGE = 1.1; --want to store result of this bellow select statement in model_count variable select PRNCT_CHANGE FROM SEMANTIC.COUNT_STATISTICS WHERE model = '&MY_MODEL' AND NEW_DATE = ( select max(NEW_DATE) from SEMANTIC.COUNT_STATISTICS where MODEL = '&MY_MODEL' ); Now, how do I return this PERCENTAGE_NUMBER variable back to my shell script? My

updating 1 million records in oracle DB as batch of 10k;

偶尔善良 提交于 2020-01-07 06:57:56
问题 I have to update a table in oracle db as batch of 10k. I tried this: BEGIN WHILE (true) LOOP UPDATE TOP (10000) CUSTOMERS SET ACTIVE = 'N' WHERE ACTIVE='Y'; IF sql%notfound THEN EXIT; END IF; COMMIT; END LOOP; END; It doesn't works as plsql doesn't support top. Any suggestions? 回答1: your pl/SQL block, using JVA's suggestion, should be completed like this (somce you are new to pl/sql I am adding some syntactical suggestions that you could be interested in): BEGIN -- WHILE (TRUE) can be omitted

Oracle SQLPlus ORA-01017 invalid credentials when specifying schema

╄→гoц情女王★ 提交于 2020-01-07 04:43:07
问题 On an Oracle11g database, this works: SQL> connect USER/pass Connected. However, this doesn't: SQL> connect USER/pass@db ERROR: ORA-01017: invalid username/password; logon denied I have executed: SQL> grant connect to USER; Grant succeeded. What am I missing? tnsnames.ora: DB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = a.dom.b.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = db) ) ) EDIT: :> sqlplus USER/pass SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar

在Linux上安装Oracle服务的操作步骤

萝らか妹 提交于 2020-01-07 04:16:48
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 如题,将我在云服务器上安装Oracle服务的惨痛经历分享出来,期间查找的资料踩过的坑无数,希望对大家能有帮助 闲话少叙,直接开始 首先,由于服务器比较差,需要先设置swap 查看是否设置swap虚拟内存 交换区(SWAP)要求:按照操作系统推荐配置,根据内存大小,为物理内存的1-1.5倍。 推荐:创建2个大小相同、且分布在不同盘(pv)上的SWAP空间。 free -m 如未设置swap虚拟内存,则设置 dd if=/dev/zero of=swapfile bs=40960 count=204800 说明: -if //输入 -of //输出 -bs //块儿大小,单位是byte,最小为40K,该语句表示8000M的大小 -count //总块数 创建Linux交换文件 mkswap swapfile 激活swapfile交换文件 swapon swapfile 查看是否生效 free -m 安装依赖包 yum install binutils compat-libstdc++-33 elfutils elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc

How to use bind variable value as prompt in SQL*Plus ACCEPT command

我是研究僧i 提交于 2020-01-07 02:43:09
问题 I'd like to use a bind variable value as input prompt in a SQL*Plus script. Here's what I've tried: 1) I defined the bind variable as follows SQL>var prompt varchar2(100) 2) and assigned a value using PL/SQL SQL>exec select 'your name' into :prompt from dual 3) now I can PRINT or select the bind variable value as follows: SQL>select :prompt from dual; :PROMPT ------------------------------------ your name SQL>print prompt PROMPT ------------------------------------ your name 4) now I'd like

Oracle truncating column

谁说胖子不能爱 提交于 2020-01-06 19:55:19
问题 I have the following query. insert into ORDER_INFO(ORDINF_PK,ORDINF_LGNDET_PK_FK,MEDIA_TYPE,ORDINF_MUSIC_FK,DAT) values (1,1,'Music',21,TO_DATE('14-OCT-2015','DD-MON-YYYY')); insert into ORDER_INFO(ORDINF_PK,ORDINF_LGNDET_PK_FK,MEDIA_TYPE,ORDINF_MUSIC_FK,ORDINF_SERIES_FK,DAT) values (2,2,'Series',71,23,TO_DATE('07-NOV-2015','DD-MON-YYYY')); however when I do: select * from ORDER_INFO; I get: truncating (as requested) before column ORDINF_SERIES_FK truncating (as requested) before column

Using Natural Join with Where operation

一世执手 提交于 2020-01-06 15:38:06
问题 I have a query that I've been using in phpMyAdmin and it's been working perfectly however I migrated my database over to different server and I am now using SQL*Plus to perform my queries. The query is now generating ERROR at line 10: ORA-25155: column used in NATURAL join cannot have qualifier Here is my query: SELECT Block FROM ( SELECT CardId, Block FROM Contains GROUP BY Block UNION SELECT CardId, Block FROM Contains NATURAL JOIN (SELECT CardId FROM Costs NATURAL JOIN (SELECT Id FROM Card

PL/SQL SQL*Plus Statement Ignored

北战南征 提交于 2020-01-06 14:43:06
问题 I'm doing a trigger on my Oracle database, here's the code CREATE OR REPLACE TRIGGER send_telegram_message AFTER INSERT ON EVENT_LOG FOR EACH ROW DECLARE GROUP_IDS VARCHAR(200); BEGIN IF :NEW.EVENT_ID AND :NEW.DESCRIPTION IS NOT NULL THEN SELECT ID_GRUPO INTO GROUP_IDS FROM V_EVENT_TELEGRAM WHERE V_EVENT_TELEGRAM.EVENT_ID = :NEW.EVENT_ID; TELEGRAM_BOT(GROUP_IDS,:NEW.DESCRIPTION); END IF; END; When compile I'm getting the following error: Error(4,3): PL/SQL: Statement ignored Error(4,6): PLS