sqlplus

How come sqlplus not connecting?

こ雲淡風輕ζ 提交于 2019-12-17 18:54:08
问题 My goal is to connect to an Oracle 9i instance from my OS X machine. I've followed the setup instructions here and got through them with no errors (eventually). However, I'm finding that sqlplus is unable to connect: [ ethan@gir ~ ]$ sqlplus xxx/yyy@zzz SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 17 10:13:08 2009 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Looooong wait... ERROR: ORA-12170: TNS:Connect timeout occurred Enter user-name: xxx Enter password: ERROR: ORA-12162:

How can I issue a single command from the command line through sql plus?

此生再无相见时 提交于 2019-12-17 10:24:18
问题 Using SQL Plus, you can run a script with the "@" operator from the command line, as in: c:\>sqlplus username/password@databasename @"c:\my_script.sql" But is it possible to just run a single command with a similar syntax, without a whole separate script file? As in: c:\>sqlplus username/password@databasename @execute some_procedure I am interested in this because I want to write a batch file that simply executes a command, without generating a bunch of two-line ".sql" files. 回答1: I'm able to

SQL*Plus how to accept text variable from prompt?

被刻印的时光 ゝ 提交于 2019-12-17 07:50:57
问题 Im very beginner in psql and i have a question. Here is the code: SET serveroutput ON ACCEPT myVariable PROMPT "Input value: "; BEGIN dbms_output.put_line('My input variable is: '||&myVariable); END; Question is very simple: How can i pass text to my variable? If i input a number it is works correctly and i can read in the log my number, but if i pass a text like "mytext" instead of a number, i got an error: old:BEGIN dbms_output.put_line('My input variable is: '||&myVariable); END; new:BEGIN

Sql*plus always returns exit code 0?

本小妞迷上赌 提交于 2019-12-17 06:52:24
问题 Whenever I run a sql script using Sql*plus and check for $?, I get 0 even when the script wasn't succesful. Example #$ sqlplus user/password@instance @script.sql SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 7 14:20:44 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.8.0 - Production v$dataf-ile d, * ERROR at line 6:

Sql*plus always returns exit code 0?

僤鯓⒐⒋嵵緔 提交于 2019-12-17 06:52:21
问题 Whenever I run a sql script using Sql*plus and check for $?, I get 0 even when the script wasn't succesful. Example #$ sqlplus user/password@instance @script.sql SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 7 14:20:44 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.8.0 - Production v$dataf-ile d, * ERROR at line 6:

Oracle: Import CSV file

℡╲_俬逩灬. 提交于 2019-12-17 04:30:52
问题 I've been searching for a while now but can't seem to find answers so here goes... I've got a CSV file that I want to import into a table in Oracle (9i/10i). Later on I plan to use this table as a lookup for another use. This is actually a workaround I'm working on since the fact that querying using the IN clause with more that 1000 values is not possible. How is this done using SQLPLUS? Thanks for your time! :) 回答1: SQL Loader helps load csv files into tables: SQL*Loader If you want sqlplus

why is 'create table' in sql script executing 3 times when only using 1 create statement? [duplicate]

本小妞迷上赌 提交于 2019-12-14 04:13:12
问题 This question already has answers here : When do I need to use a semicolon vs a slash in Oracle SQL? (6 answers) Closed 2 years ago . I have an SQL script in which I want to automate the creation of a table. However, when I exec it, it seems as though it's trying to create the table 3 times. The first time, it creates the table. The next 2 times, it complains it already exists by throwing an "ORA-00955: name is already used by an existing object" Here my sql script(@/vagrant/scripts/db_tables

In oracle 10g, how do I accept user input in a loop?

久未见 提交于 2019-12-14 03:53:53
问题 I have the following pl/sql block: BEGIN FOR I IN 1 .. 5 LOOP INSERT INTO TEST_TABLE VALUES('&slno',SYSDATE); END LOOP; END; When I executed the above block it is taking only one input. But it is supposed to take 5 input in total. What is missing in my code? Can any one help me please? 回答1: It is a substitution variable - an sql*plus feature - and it doesn't work this way. You have to call undefine &slno or accept slno ... to make it take another input, but these are also sqlplus, not pl/sql

Is this a possible Oracle bug or am I missing something?

无人久伴 提交于 2019-12-14 03:52:07
问题 Database is Oracle 10.2.0.1.0 - 64bit running on Red Hat Enterprise Linux ES release 4 (Nahant Update 8) In SQL*Plus following code run perfectly: var comment_id number exec :comment_id := 3052753 select e.label as doc_name, e.url, i.item_id, 'multi' as form_type from cr_items i, cr_extlinks e where i.parent_id = :comment_id and e.extlink_id = i.item_id UNION select null as doc_name, utl_raw.cast_to_varchar2(DBMS_LOB.SUBSTR(r.content, 2000, 1)) as url, r.item_id, 'single' as form_type from cr

ICannot figure out how to run queries for student

人走茶凉 提交于 2019-12-13 10:27:35
问题 Here is my code that I created for each of the tables, not sure how to join the tables to calculated the gpa's?? CREATE TABLE Student(SSN NUMBER(4) NOT NULL, SName VARCHAR(20) NOT NULL, Major VARCHAR(4), 回答1: Because grade and SSN are in the grades table, you dont need to join and can get the average grade like this: This gives the average grade per student, ordered by the grade: SELECT AVG(g.Grade), g.SSN FROM Grade g group by g.SSN order by AVG(g.Grade) If you wanted average grade per