sqlplus

oracle query - ORA-01652: unable to extend temp segment but only in some versions of sql*plus

删除回忆录丶 提交于 2019-12-07 06:34:49
问题 This one has me rather confused. I've written a query which runs fine from my development client but fails on the production client with error "ORA-01652: unable to extend temp segment by....". In both instances, the database and user is the same. On my development machine (MS Windows) I've got SQL*PLUS (Release 9.0.1.4.0) and Toad 9.0 (both using version 9.0.4.0.1 of the oci.dll). Both run the code without errors. However when I run the same file, against the same database, using the same

How do you assign the result of an expression to an SQL substitution variable?

倾然丶 夕夏残阳落幕 提交于 2019-12-07 05:31:35
Can you evaluate an expression and assign the result to a substitution variable? In my case, I need to call an old script which contains a substitutions variable. I need to calculate a value for that variable before calling the script. I'm using Oracle SQL and SQL*Plus Here's the basic problem: def this_num = 2+2 @old_script Inside old_script.sql select '&this_num' from dual; -- Probably shouldn't change this Yields: '2+2' Is there a way to force evaluation so that the substitution variable gets the result of an expression rather than the expression itself? def this_num = 2+2 @old_script In

How to prevent dbms_output.put_line from trimming leading whitespace?

烂漫一生 提交于 2019-12-07 05:04:12
问题 I am trying to right-align the output of some PL/SQL code, but dbms_output.put_line is trimming the leading whitespace from my strings. How do I make it stop? Or is there a better way to output strings with leading whitespace? dbms_output.put_line(lpad('string', 30, ' ')); outputs: string instead of: string 回答1: The problem is not with dbms_output but with SQL*Plus. Use SET SERVEROUTPUT ON FORMAT WRAPPED or SET SERVEROUTPUT ON FORMAT TRUNCATED to preserve the spaces. From the documentation

SQLPlus AUTO_INCREMENT Error

大兔子大兔子 提交于 2019-12-07 04:15:40
问题 When I try and run the following command in SQLPlus: CREATE TABLE Hotel (hotelNo NUMBER(4) NOT NULL AUTO_INCREMENT, hotelName VARCHAR(20) NOT NULL, city VARCHAR(50) NOT NULL, CONSTRAINT hotelNo_pk PRIMARY KEY (hotelNo)); I get the following error: (hotelNo NUMBER(4) NOT NULL AUTO_INCREMENT, * ERROR at line 2: ORA-00907: missing right parenthesis What am I doing wrong? 回答1: Many will gripe about this not being a standard feature in Oracle, but when it’s as easy as two more commands after your

Getting SQLPlus to spool out Unicode characters, are being output as?

早过忘川 提交于 2019-12-07 00:34:30
问题 I am attempting to get Oracle sqlplus (10.2) to spool out Unicode data on a Linux machine. I have found several discussions of this issue, but no clear answers, other than to check locale settings and set NLS_LANG to AL32UTF8. All locale info is set to "en_US.UTF-8", I'll post the full output upon request. The OS (vi, etc.), will recognize and accept Unicode characters without issue. However, when using sqlplus, all non-ASCII characters are changed to ? characters. The Oracle DB has NLS

Can not connect ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

戏子无情 提交于 2019-12-06 23:14:28
I want to connect my PLSQL developer tools into database but fail to connect due to error below. ORA-12514: TNS: listener does not currently know of service requested in connect descriptor Check configuration below. How to configure to make it works? SQL> select value from v$parameter where name='service_names'; VALUE orcl SQL> select instance from v$thread; INSTANCE orcl SQL> select host_name,instance_name,version from v$instance; HOST_NAME INSTANCE_NAME VERSION ex-cs-b orcl 11.2.0.1.0 SQL> select global_name from global_name; GLOBAL_NAME ORCL SQL> lsnrctl status LSNRCTL for Linux: Version 11

How to use LIKE statement in sql plus with multiple wild carded values?

筅森魡賤 提交于 2019-12-06 15:43:29
my question is that currently if i want to query for multiple wildcarded values. I need to do something like this. select customername from customers where customername like '%smith' or customername like '%potter' or customer name like '%harris' or customername like '%williams'; So I wanna ask from the experts, is there any easier way to do this? Regards, Sanjan Create a table of your 100 names select customername from customers c inner join customersames cn on(c.customernamename like '%'+cn.searchForname) Can be a table variable if that helps. you can use regular expressions EDIT: You can

Generate and insert large CLOB (1 MB) using SQL*Plus

喜你入骨 提交于 2019-12-06 15:29:13
For test purposes, I would like to insert a large amount of data (approx. 1 MByte) into an Oracle CLOB column. In order to keep the test simple, I want to do that without having to write a test program using C++ or Java; instead, I want to use SQL*PLus. Does Oracle's SQL syntax offer any possibility to do that? I.e. instead of the EMPTY_CLOB() function, I would need something like MAKE_CLOB('x', 1000000) that makes a CLOB by repeating a character 1,000,0000 times. (Note: I specifically do not want to insert the CLOB by using a SELECT clause within the INSERT statement to select a large CLOB

Execute SQL*Plus from PowerShell

落花浮王杯 提交于 2019-12-06 15:11:19
I got two files in C:\temp\SQL\alex.sql and in C:\temp\alex.ps1 . In C:\temp\SQL\alex.sql , that is simply select count(*) from user_tables; quit; In C:\temp\alex.ps1 , that is $cmd = "sqlplus"; $args = "user/password@server/sid @C:\temp\SQL\alex.sql"; &$cmd $args; I tried the command in Command Prompt sqlplus user/password@server/sid @C:\temp\SQL\alex.sql which executed perfectly! The SQL file is not executed at all, but SQL*Plus help is shown. What did I do wrong? Thanks! I found the solution myself I use cmd.exe /c and alex.ps1 is now $cmd = "cmd.exe"; $args = "/c sqlplus user/password

How to connect to Azure Oracle 12c Database using sqlplus or sql developer cloud connection

五迷三道 提交于 2019-12-06 11:50:20
问题 I have 2 VM in azure one is a DB server and the other is a web server. I can get remote desktop connection for both these servers and web server can connect to Database wih sqlplus user/password@internal_network_ip:port/sid But however I cannot connect to Cloud DB from my local system. I tried sqlplus user/password@internal_ip:8552/sid ORA-12170: TNS:Connect timeout occurred sqlplus user/password@xxxx.something.net:8552/sid -- oracle port ORA-12170: TNS:Connect timeout occurred sqlplus user