sqlplus

creating database in oracle10g

In mysql i can create a new database so easily just by writing a command. Mysql>create database database_name; In oracle 10g the default database name is XE. Can anybody tell command to create a new database other than XE ? I am using Linux(fedora-12). ...

How to duplicate a table with all its constrains in SQL*Plus?

Using create table tab2 as select * from tab1;, I am able to copy the data but not the primary key constraint : SQL> desc tab1; Name Null? Type ----------------------------------------- -------- ---------------------------- ID NOT NULL NUMBER NAME ...

The OLD: and the NEW:

I am using Oracle SQL Developer. I am using parameters &TableName My query comes back to me in the results with an OLD: tag before it, and again with a New: tag (the variable is replaced with the value that I have typed in) and then my results follow this. How do I get rid of this annoying return and change it to just display my resul...

Convert epoch to date in sqlplus / Oracle

Hi, I have the following table: SQL> desc recording Name Null? Type -------------------- -------- ------ CAPTUREID NOT NULL NUMBER(9) STARTDATE NOT NULL DATE ENDDATE DATE STATE NUMBER(1) ESTIMATEDENDTIME NUMBER(13) Here's a sing...

shell script which will interact with the database

Have been writing the shell script such as : #! /bin/bash `sqlplus -s <username>/<passwd>@dbname` set echo on set pagesize 0 set verify off set lines 32000 set trimspool on set feedback off `SELECT tr.number, count(*) as total FROM <dbname>.<tablename1> tr LEFT JOIN <tablename2> t2 ON t2.i...

SQL plus running multiple queries

I have 12 queries to run, but can not run at the same time. I would like to start the first query, then as soon as it completes the next query begins, when it completes the third query starts and so on. Want this to be automatic. Each query writes a txt file. Thanks ...

Applying Oracle PL/SQL via JDBC

Is it possible to create/replace PL/SQL via the Oracle JDBC driver, i.e not via SQLPLus* ? Update 1: Driver: ojdbc14 (JDBC) Update 2: Change is being applied to oracle via Ant <SQL> task, which is passed a sql script file. In this instance using SQLPlus in the Ant script is not possible (long story). ...

Precedence of operators in SQL*Plus

How is A - B U B - A parsed in SQL*Plus? Is it parsed as (A - B) U (B - A) or as A - (B U B) - A ? I could find this page using Google, but it doesn't say which has higher precedence, U or -. ...

How to override precedence in SQL*Plus?

select * from tab1 minus select * from tab2 union select * from tab2 minus select * from tab1 How can I make sure that it is parsed as this? ((select * from tab1 minus select * from tab2) union (select * from tab2 minus select * from tab1)) ...

SQL Plus and www.apex.oracle.com

Does the SQL syntax differ in any way for SQL Plus and apex.oracle.com From this article I can assume that it doesn't, but I want to be sure. Is SQL Plus only an environment that is able to connect to an Oracle server ? I'm asking this because I just started learning Oracle's SQL syntax and I don't have access to my faculty's server fro...

How to set minvalue of sequence to result of a select query?

Hello all, I am trying to create a sequence in oracle sql, using the "minvalue" as the result of a select query. The select query I'm trying to run is: SELECT MAX(customer_id) + 1 FROM customer I know it's easy with an anonymous pl/sql, but I'd like to find a way which doesn't use pl/sql. Some ideas I've had include the ...

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

Hi all, 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 T...

Backing up SQL Plus environment during script

Some scripts I have inherited will blindly call SET FEEDBACK OFF or SET ECHO OFF at the beginning of the script, then set them to ON or OFF at the end of the script. I would like to modify these scripts to determine what value was set before the script was run, and set the environment back to that value when the script completes. How d...

No way to execute SQL script from SQL Server Query Manager like @{file.sql} oracle sqlplus syntax?

Like the title says, in oracle you can issue the following command in SQL*Plus: SQL> select something from anothertable; #sql SQL> @{/home/me/somescript.sql}; #load sql from file and execute it SQL> do something else in script; #other sql Without having to file->open the sql script to load it to the UI. Is there an equ...

Oracle SQLPlus setting environment variable based on variable

I want to set the environment variable long based on the size of the XML data I'm trying to retrieve. The idea is something like this: var XML_DATA_SIZE number; SELECT TRIM(LENGTH(xmltype.getClobVal(xml_data))) INTO :XML_data_size FROM xml_tab WHERE key = '1234'; print XML_DATA_SIZE set long XML_DATA_SIZE set pagesize 0 set li...

Inserting UNICODE characters in Sql .

Hi , I am trying to get unicode strings into an SQL*Plus: Release 10.2.0.2.0 database but am having difficulties. If I use SQLPlus and copy and paste the insert statement into the database, any special characters are inserted as ? or something like that. I then try to call a sql file that has been encoded to UTF-8 and the outcome is th...

SQL Plus convert table to CSV file problem

I'm having a problem that I can't figure out while converting a table field in an Oracle database to a CSV file. I have a column of varchar2(4000) where users enter their comments. Sometimes the users copy and paste text from other programs such as MS Word therefore, a lot of extra information is pasted into the field such as carriage ...

How can i call pl/sql stored procedure (function, returning number value)?

Hi, I'm using oracle sql developer, or oracle sqlplus. Thank, Mattan ...