Using SQL*PLUS Insert ??
oracle 10G, using command line SQL*PLUS.
I want to make 10 insert at a time, USING the ED mode.
I want to load this into SQL
ie insert ..;
insert...;
insert ..;
commit ;
Here is an example for a windows client.
If you type 'ed' at the sql prompt and hit enter key, an editor window will show up. Type all your statements.
Use the 'Save as' option from the 'file' menu to save the file (for example, 'abc.sql'). Close the editor. At the sql prompt, type '@path\abc' or 'start path\abc'.
Similar Messages
-
Insert more than 4000 characters using sql plus
I have a SQL script that creates a database. The problem is that some of the fields are longer than 4000 characters in the INSERT statement and Oracle doesn't seem to like it.
The field is a clob and works fine in the application (i.e. I can insert more than 4000 characters using the app) - how do I achieve this in a SQL script?
Any help is much appreciated.
Cheers,
SteveHi,
This pl/sql block works absolutely fine in SQL*Plus inserting > 4000 characters into clob column:
declare
l_str varchar2(8000);
l_str1 varchar2(2400) := 'first part of the verly long string...';
l_str2 varchar2(2400) := 'second part of the verly long string...';
begin
l_str := l_str1 || l_str2;
insert into tmpl values (l_str);
end;
So, you'll have to replace inserts with pl/sql blocks in your script.
Tested in Oracle 8.1.7.0.0
Regards,
Andrew Velitchko
BrainBench MVP for Developer/2000
http://www.brainbench.com -
Inserting Special Character using SQL*Plus
I am trying to insert special character like ® using SQL*Plus but it is inserting a .(dot) instead.
Environment:
Oracle Enterprise version : 9.2.0.3.0
Sun Solaris 8
Any help will be appreciated.
Regards,
NirmalyaThat's the reason I use ASCII values always for special characters.
SQL> create table sample1(col1 varchar2(50))
2 /
Table created.
SQL> insert into sample1
2 select 'The temperature outside is 20'||chr(176)||' centigrade' col1
3 from dual
4 /
1 row created.
SQL> commit
2 /
Commit complete.
SQL> select * from sample1
2 /
COL1
The temperature outside is 20° centigrade
1 row selected.
SQL> drop table sample1 purge
2 /
Table dropped.
SQL> Cheers
Sarma. -
Debugging procedure or packages using sql*plus reg
Dear all,
I am new to oracle, can any body provide me some information related to this below issues.
a) suppose i have created a procedure using sql*plus tool then next day i wanted to debug or modify my stored procedure.
Then what could approach using sql*plus
b) same case if we consider for packages then for any specific stored procedure or functions what would be the approach to debug or modify using sql*plus
yours cordination will be highly appreciate
Thanks n regards
LaxmanUsing SQL*Plus you can debug your stored pl/sql code only adding some "prints" in your code:
SQL> create or replace procedure test is
2 begin
3 dbms_output.put_line('starting...');
4 --do something here
5 dbms_output.put_line('done step 1');
6 --do something else here
7 dbms_output.put_line('end procedure...');
8 end;
9 /
Procedura creata.
SQL> set serverout on
SQL> exec test
starting...
done step 1
end procedure...
Procedura PL/SQL completata correttamente.Or writing logs in a log table:
SQL> create table logtab(ts timestamp(9),mess varchar2(4000));
Tabella creata.
SQL> create or replace procedure test is
2 begin
3 insert into logtab values(systimestamp,'starting...');
4 --do something here
5 insert into logtab values(systimestamp,'done step 1');
6 --do something else here
7 insert into logtab values(systimestamp,'end procedure...');
8 end;
9 /
Procedura creata.
SQL> exec test
Procedura PL/SQL completata correttamente.
SQL> col ts for a40
SQL> col mess for a40
SQL> select * from logtab;
TS MESS
25-DIC-09 15:33:13,656000000 starting...
25-DIC-09 15:33:13,656000000 done step 1
25-DIC-09 15:33:13,656000000 end procedure...Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com] -
Populating table using SQL*Plus
Hi,
I am trying to populate my destination table from the source using SQL*Plus. I keep get error message. The source table has 6 columns and the destination table has 11 columns. Data_type are different in both table. The following is my script and the output of the script:
insert into bim_expense_element
(select table_type_id, table_code_desc,
table_value_4, table_value_6,
table_description_1 | | table_description_2
from edim_expense_element)
SQL> /
insert into bim_expense_element
ERROR at line 1:
ORA-00947: not enough values
Please let me know what I did wrong. Thanks.
EstherHi Esther,
You need to tell to Oracle what columns to fill in your insert like this:
insert into bim_expense_element(bim_type_id, bim_code_desc, bim_table_value4, bim_table_value6, bim_description)
select table_type_id, table_code_desc,
table_value_4, table_value_6,
table_description_1 | | table_description_2
from edim_expense_element
If the fields aren't of the same type you'll need to convert.
null -
Create database table using Forms Developer 6/6i without using SQL*Plus
hello there,
I need help in creating tables in Oracle using Forms Developer 6/6i without using SQL*Plus interface.
your help is appreciated
email: [email protected]please use Forms_ddl package to create a table dynamically
from the Developer6/6i.
you can check the success or failure by using the
form_success builtin.
if u want to avoid using the Forms_ddl package
use stored procedure or create a sql querry record group.
regards
sriram. -
Can v read a client text file using SQL*plus??
We have a requirement like this: We need to read a text file to find spelling mistakes. Problem is the file has to be always moved to the DB machine, which is a Linux box and then run a stored procedure which uses UTL_FILE. Now in order to show the spelling mistakes of the file the user will have to again copy the file with the spelling mistakses (output file) from Linux to Windows.
Is there a way to do it using SQL*Plus, where the text file is in the client machine???? Then users don't have to copy the file to and from the Linux box.SQL*Plus is a client software and whatever code you write using SQL*Plus, it ultimately run on the server. So the answers to your question is "no".
-
Cannot connect to database using SQL*Plus
Hi, I have Oracle 10g XE installed in my labtop and I cannot connect using SQL*Plus.
I can connect using the broser User Interface though, which I was able to do after doing the following procedure to change the password of the sys account:
- open a command prompt
- - type sqlplus
- On the “Enter user-name” line, type /as sysdba
- On the SQL> prompt, type alter user sys identified by NewPassword;
But the thing is that even though I am able to connect using sys/NewPassword from my browser UI, I dont get the same result when doing it using the SQL prompt.
What I am trying to do is this:
SQL> connect sys/NewPassword
Then I get first a warming saying that I need to use either sysdba or sysoper to connect to the system account, but neither of those work.
Can anyone advice me on this matter?
Thanks in advanceThanks for that.
I run the command to list the usernames on the database and I got SYS and SYSTEM in the list. But again, when I try to use SYS with a password that I know is working because I can access it through the browser UI, it doesnt work. It seems like this sys is different to the sys I used in the UI.
I dont know if I am explaining myself correclty... In the Browser UI I use sys, and a password and I get connected to the sys account. However, if I try to use the same sys.password combination from my sqlplus prompt, I get error messages
Does this make sense at all? -
11g: can connet using SQL*PLUS, not with TOAD
Hi
I run into a problem with TOAD. I can't connect with my 11g database using TOAD. I don't get any messages it just gives me a little waiticon for a split second and then nothing happens. I can however connect to my 10g database using TOAD. Using SQL*Plus I can connect to both.
I use TOAD 8.6. Do I need a newer version maybe??...I can connect like:
hr/pw@xe
or
hr/pw@O11R1
or directly, no problem. I can connect from SQLplus to both databases any way I want -
Can I use SQL *Plus 11.1.0.7.0 to connect Oracle Express 10g
Hi guys:
I download "Oracle 11g ODAC *11.1.0.7.20* with Oracle Developer Tools for Visual Studio", trying to use SQL *plus to see if configuration is alright.
But after entering account/pwd, I got a error:
ORA-12560: TNS:protocol adapter error
What is wrong with my environment?
Thanks,
Rickyuser12086319 wrote:
Hi EdStevens,
Following the instructions in previous post, I can connect with SQL plus (the database is on the same box* as your sqlplus client); I just enter sqlplus in windows console.
In addition, i am still curious about how SQL plus connect to a remote* box. Could you shed more light on that?SQLPlus connects to a remote db the same way any other app does. After all, sqlplus is just another client app.
It's all in the connect string. So say, at a command prompt you enter
$> sqlplus scott/tiger@mydbso in the above example, 'scott' is the user, 'tiger' is the password, and 'mydb' is the tns service name. Of course, the OS passes all that to sqlplus as a command line parameter. Internally, sqlplus makes a call to the tns layer and passes it the connect information it has. TNS will take a look at the tnsnames.ora file and find an entry for 'mydb', and from there it will get the name or ip address of the host server, a port number, and a service name. That information will be passed on down the network stack for routing. (If a name was provided instead of an ip address, the OS network stack will use whatever means are at its disposal - a hosts file, a dns lookup, or whatever, to get an ip address). The request will arrive at the specified host and placed on the specified port. If everything was configured correctly, there will be an oracle listener process monitoring that port. It will pick up the request and see if it recognizes the service name. If it does, it will spawn a user server process on a different port to complete the connection, then get out of the way and continue listening for more requests.
This is how it happens most of the time. There are a lot of other variants, but that's the gist of it.
More information can be found in the fine documentation at tahiti.oracle.com. -
Modifying Stored Procedue Using SQL Plus
Can you modify an existing procedure using SQL Plus?
you can write your own "editor"
editproc.sql
set feedb off echo off termout off head off trimsp on lin 10000 pages 0
spool tmpproc.sql
select dbms_metadata.get_ddl('PROCEDURE','&1') p from dual;
spool off
get tmpproc nolist
ed
set feedb 6 termout on
/than, to edit procedure P in sqlplus
SQL> @editproc P
(... edit it ...)Procedure created.
SQL> -
Listener is listening but when we use sql*plus ORA-12203
Hi all,
listener is listening but when we use sql*plus ORA-12203
we are trying to connect oracle database in VPN, all the configuration is ok, the listener is listening at db-server site with 1521
we can connect with tnsping, but when we connect with
sqlplus it not going through. any boidy has experienced this. any one can help?
Thanks in advanceTNSNAMES.ORA file is
it works when i try with serice name factory through LAN, then im disconnectinag at LAN and try through VPN, it doesnt go.
here is TNSNAMES.ORA copy .
Beq-local.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = beq.world)
(PROTOCOL = BEQ)
(PROGRAM = oracle73)
(ARGV0 = oracle73ORCL)
(ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')
(CONNECT_DATA = (SID = ORCL)
Tcp-loopback.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 127.0.0.1)
(Port = 1521)
(CONNECT_DATA = (SID = ORCL)
Example1.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = Production1)
(Port = 1521)
(CONNECT_DATA = (SID = SID1)
Example2.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = spx.world)
(PROTOCOL = SPX)
(Service = Server_lsnr)
(CONNECT_DATA = (SID = ORCL)
Example3.world =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = nmp.world)
(PROTOCOL = NMP)
(Server = FinanceServer1)
(Pipe = ORAPIPE)
(CONNECT_DATA = (SID = ORCL)
factory =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = DBSERVER)
(Port = 1521)
(CONNECT_DATA = (SID = MYDATABASE)
factory1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = tcp.world)
(PROTOCOL = TCP)
(Host = 172.27.32.22)
(Port = 1521)
(CONNECT_DATA = (SID = MYDATABASE)
) -
Help Using SQL*Plus Format Commands (like TTITLE) in Packages
Where (within a package) can/should SQL*Plus format commands such as TTITLE, COLUMN & BREAK be coded?
A package is coded in PL/SQL.
TTITLE, COLUMN and BREAK are SQL*Plus commands, they cannot be used in PL/SQL.
If you want to output data (using dbms_output) in your package, you'll have to implement the features yourself. But probably just using SQL*Plus is better in your case.
Regards,
Rob. -
Using sql*plus to login to oracle 9i
I have installed Oracle 9i for windows and am trying to login using SQL*PLUS
user: system
pwd: manager
Host String: BHURU
It says TNS could resolve service name.
I have all the services running in the admin monitor.
Am I missing something?This is not a right forum to post your problem. This is SQL PL/SQL forum.
Please post it in Database General Forum.
Regards.
Satyaki De. -
Calling SQL scripts from subdirectories using SQL*Plus 9.2.0.1
Is it possible to run an SQL script that in turn calls other SQL scripts from subdirectories? This seemed to work fine using SQL*Plus 8.1.7
Did it break in 9.2.0.1?
Any fixes available?Ryan,
What exactly is your problem? Can you tell me any errors you are seeing? Platform?
Alison
Maybe you are looking for
-
JSF sample application in WLP 10.3.2
Hi All, I am new to JSF and trying to build a sample application in WLP 10.3.2. I created a jsp with simple form and submit. Created a JSF portlet with that JSP. When I try to deploy and run the portlet, I get this error on the console. +<Aug 15, 201
-
ITunes won't open! Error -42404
I was recently upgrading my computer with upgrades that my mac came up with for me and my computer shut down in the middle of it. When I turned it back on again the upgrade window was gone and when I tried to open my iTunes I got this error message:
-
Hi Experts I found in SAP code the usage of * sign but it wasnt in select statement. Anyone knows how below statement works? i_frggr = *ekko-frggr Thanks in advance. az
-
I have all of my photos stored on an external hard drive and cannot get atv to sync them. This used to work but since upgrading to leopard I can no longer sync the photos on the external hard drive. The sync symbol is rolling in itunes and I get no e
-
How do I get an ap div (layer) to stack on top...it is so easy in all other adobe programs...I can't even find a layers panel. Thanks!