SQL comment in "sql * more ' runs inside.
See code below. Why I get after release:SQL> /*select sysdate from dual*/
SYSDATE
----------
16.08.2010
I have enterd only a comment why it comes out as a command? Is there a solution for Sql * more so that he would interpret "/ * aa * /"-style comment as true comment? ".SQL*Plus: Release 10.2.0.3.0 - Production on E Aug 16 14:17
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 -
With the Partitioning, OLAP and Data Mining options
SQL> /*select sysdate from dual*/
SP2-0103: Nothing in SQL buffer to run.
SQL> select sysdate from dual;
SYSDATE
----------
16.08.2010
SQL> /*select sysdate from dual*/
SYSDATE
----------
16.08.2010
SQL> /* select sysdate from dual */
SQL> select sysdate from dual;
SYSDATE
----------
16.08.2010
SQL> /* select sysdate from dual; */
SQL> select sysdate from dual;
SYSDATE
----------
16.08.2010
SQL>
I don't know, but it's because
entry has / SQL more will take place the last executed query.
So in / * select sysdate from double * /.
Maybe sqlplus takes just the first and therefore the executed query previously running
Tags: Database
Similar Questions
-
trying to get used to sql * more running and creating a simple procedure
Hello all;
I'm getting used to sql * more after using for a while using pl/sql developer.
I am trying to create a simple procedure and run it. See my procedure below
and then I type in run hr.test ("J", 10); to run this and then press ENTER, and it does nothing. How can I run and create a simple procedure in sql * morecreate or replace procedure test(t in varchar2(200), limit in number(30)) begin select tbl_report.id from tbl_report where tbl_report.id like '|| t ||%' and rownum <= limit; end test;
Hello
In addition to all the good points, others have done:
When you issue a SELECT statement in SQL * Plus (or any other front end) two things happen:
(1) a result set, containing the results of your query, is produced, and
(2) this result set is displayed.
Given that these two things are always done together, it is easy to forget that they are two different things.
In PL/SQL, you must explicitly do something to catch the result set, and you must explicitly do something else to view it (if you want to display it).A simple way to get the result set is to use a cursor FOR loop, to extract a line at a time and run code with this line in a record variable (called the country in the example below).
View the results is to call dbms_output.put_line.Here is an example:
CREATE OR REPLACE PROCEDURE test ( t IN VARCHAR2 , lmt IN NUMBER -- LIMIT is an Oracle keyword; best not to use it as a variable name ) IS BEGIN FOR country IN ( SELECT country_name FROM hr.countries WHERE country_name LIKE t || '%' AND ROWNUM <= lmt ) LOOP dbms_output.put_line ( country.country_name || ' = country_name' ); END LOOP; END test; / SHOW ERRORS
You can use variables, such as t and lmt, in the query without using dynamic SQL, as long as the variables do not have the same names as the columns in the table. In this case, t and lmt are good names; country_name or region_id wouldn't. (In fact, t is a reputable insofar as it cannot be confused with a column in the table of the country. T is not a good reputation in the sense that it does not give much information about what contains the variable, or how it is used. Why not call the variable target_name or name_a_trouver?
You can run the SQL procedure * more like this:
SET SERVEROUTPUT ON EXEC test ('I', 2);
If you issue the SET SERVEROUTPUT ON command, then you will not see the output of dbms_output. You must only issue the command SET SERVEROUTPUT ON once per session, but nothing bad happens if you do it more than once.
When I ran the procedure as stated above, I got this output:
Israel = country_name India = country_name
Notice that "The Italy" does not appear, because lmt has 2.
Do not create your own procedures, tables or other objects in the HR schema, or among all the other patterns created by Oracle. Create your own schema and create procedures and other objects in it.
-
Can I connect to SQL * more as SYS after connecting as a user and then run a GRANT?
Oracle 11 g 2
Linux RHEL 6.3
SQL * Plus 11.2.0.2 on Windows 7
------------------------------------------------
I am running a script SQL through SQL * more connected as "DOE, JOHN".
In the SQL script, I need to connect as SYS to make a GRANT EXECUTE on a SYS package (e.g. GRANT EXECUTE ON DBMS_CRYPTO to JOHN;).
But it fails with the following error:
GRANT EXECUTE ON TO JOHN DBMS_CRYPTO
*
ERROR on line 1:
ORA-01917: user or role 'JOHN' does not existBut of course, 'JOHN' are. The rest of the SQL script is running "DOE, JOHN" without any problem.
The code segment of SQL script in question is:
connect sys/password as sysdba
GRANT EXECUTE ON DBMS_CRYPTO TO ROYSECITYDATA; <-fails here
to connect/DOEPlease advise on what my being the issue.
tx103108 wrote:
I connect to a remote database. All dbs distance have the same instance name as they are all images. I see where you're going (I think). Should I try
I'll try to connect sys/password@MYDB
Sounds like a plan... (the instance_name returned with what you expected? or something else?)
-
Same code running in SQL * more edit the sql buffer vs = different results file
Hello
For the last few minutes I was scratching my head trying to understand why my little piece of code was not working.
As a result, a sample:
When run interactively, I get the following results:create or replace type booktitles_nt is TABLE OF VARCHAR2(100); / declare booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984'); begin for i in booklist.FIRST .. booklist.LAST LOOP dbms_output.put_line('Book number ' || i || ':' || booklist(i)); end loop; end; /
So I try without the slash and get nowhere:1 create or replace type booktitles_nt is TABLE OF VARCHAR2(100); 2 / 3 declare 4 booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984'); 5 begin 6 for i in booklist.FIRST .. booklist.LAST LOOP 7 dbms_output.put_line('Book number ' || i || ':' || booklist(i)); 8 end loop; 9* end; SCOTT@ORCL> / Warning: Type created with compilation errors. SCOTT@ORCL> show errors Errors for TYPE BOOKTITLES_NT: LINE/COL ERROR -------- ----------------------------------------------------------------- 2/1 PLS-00103: Encountered the symbol "/"
So I think, maybe I'll try it in a .sql file. So I put the first fragment of code in a file, test4.sql:1 create or replace type booktitles_nt is TABLE OF VARCHAR2(100); 2 declare 3 booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984'); 4 begin 5 for i in booklist.FIRST .. booklist.LAST LOOP 6 dbms_output.put_line('Book number ' || i || ':' || booklist(i)); 7 end loop; 8* end; 9 / Warning: Type created with compilation errors. SCOTT@ORCL> show errors Errors for TYPE BOOKTITLES_NT: LINE/COL ERROR -------- ----------------------------------------------------------------- 2/1 PLS-00103: Encountered the symbol "DECLARE" 8/4 PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ( begin case declare end exception exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge
and run it, and it works:SCOTT@ORCL> get C:\Users\J\Documents\SQL\test4.sql 1 create or replace type booktitles_nt is TABLE OF VARCHAR2(100); 2 / 3 declare 4 booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984'); 5 begin 6 for i in booklist.FIRST .. booklist.LAST LOOP 7 dbms_output.put_line('Book number ' || i || ':' || booklist(i)); 8 end loop; 9* end; SCOTT@ORCL>
Can someone tell me why the behavior is different when it is run from a file when it is run, well, interactive? There seems to be some limits on what you can interactively run vs. what you can run from a script.SCOTT@ORCL> @C:\Users\J\Documents\SQL\test4.sql Type created. Book number 1:Great Expectations Book number 2:Ulysses Book number 3:1984 PL/SQL procedure successfully completed.
Thank you very much
JasonSQL * more buffer cannot contain more than one return, even if you have two - create type and anonymous PL/SQL block. Thus it-error:
Wrote file afiedt.buf 1 create or replace type booktitles_nt is TABLE OF VARCHAR2(100); 2 / 3 declare 4 booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984'); 5 begin 6 for i in booklist.FIRST .. booklist.LAST LOOP 7 dbms_output.put_line('Book number ' || i || ':' || booklist(i)); 8 end loop; 9* end; SQL> / Warning: Type created with compilation errors. SQL> create or replace type booktitles_nt is TABLE OF VARCHAR2(100); 2 / Type created. SQL> declare 2 booklist booktitles_nt := booktitles_nt('Great Expectations','Ulysses','1984'); 3 begin 4 for i in booklist.FIRST .. booklist.LAST LOOP 5 dbms_output.put_line('Book number ' || i || ':' || booklist(i)); 6 end loop; 7 end; 8 / Book number 1:Great Expectations Book number 2:Ulysses Book number 3:1984 PL/SQL procedure successfully completed. SQL>
SY.
-
Problem with the new line when you manually run a procedure in SQL * more
The procedure below works fine in SQL * more when all EXEC < procedure_name > (parameter1, parameter 2,...); is placed on a single line
I wanted to perform the same procedure with readability. So, I put each parameter on a separate line and try to run. But it's the slightest mistake out.SQL > exec cust_admin_util.create_schema (P_SCHEMA_NAME => 'SCOTT_01', P_SCHEMA_PWD => 'scott123', P_TBS_NAME => 'TRAG_TBS', p_temptbs_name => 'TEMP' ); PL/SQL procedure successfully completed.
No work around for this?SQL > exec cust_admin_util.create_schema ( P_SCHEMA_NAME => 'TESTUSR_01', P_SCHEMA_PWD => 'scott123', P_TBS_NAME => 'TRAG_TBS', p_temptbs_name => 'TEMP' );BEGIN cust_admin_util.create_schema; END; * ERROR at line 1: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'CREATE_SCHEMA' ORA-06550: line 1, column 7: PL/SQL: Statement ignored SQL > 2 3 4 5 6 7 P_SCHEMA_NAME => 'TESTUSR_01', * ERROR at line 2: ORA-00928: missing SELECT keyword
Tom wrote:
No work around for this?
BEGIN cust_admin_util.create_schema ( P_SCHEMA_NAME => 'TESTUSR_01', P_SCHEMA_PWD => 'scott123', P_TBS_NAME => 'TRAG_TBS', p_temptbs_name => 'TEMP' ); END; /
SY.
-
Hello all;
I know this question has been asked several times but I'm still a little confused. I installed oracle database 10g express edition on my computer for the practice of the school. It works fine if I go to the homepage of database icon... However, there is another icon which evokes SQL * who I am trying to use to run sql on my computer but nothing happens when I type in a simple sql statement. I was just wondering how to make sql * more correctly installed on my pc so that I can use PL/SQL instructions for the code, packages, and triggers as well.You must copy the entry in the tnsnames.ora file for the installation of xe, which is located in
C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN
on WindowsXE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST =host.xx.xxx.net)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) )
and edit the tnsnames.ora file from where you are running more than SQL.
For example, I have a client installed 10g, which has its own file tnsnames.ora but I also 11g XE installed.
This entry must exist in the customer 10g tnsnames.ora file if I want to connect with the version of windows
SQL Plus to Database 11g XE.Moreover, why don't you upgrade to 11g xe?
http://www.Oracle.com/technetwork/database/Express-Edition/downloads/index.htmlThe final version was released earlier this month.
-
Cannot run PL/SQL using SQL * more
Hello
I am very new in the SQL environment. I want to run the following PL/SQL code, which should allow me to send an e-mail, using sql * more:
DECLARE
l_mailhost VARCHAR2 (64): = "qiudubcorrel001.qa.local";
l_from VARCHAR2 (64): = "[email protected]";
l_to VARCHAR2 (64): = "[email protected]";
l_mail_conn UTL_SMTP.connection;
BEGIN
l_mail_conn: = UTL_SMTP.open_connection (('10.253.14.240'), 25);
UTL_SMTP. HELO (l_mail_conn, '10.253.14.240');
UTL_SMTP.mail (l_mail_conn, l_from);
UTL_SMTP. RCPT (l_mail_conn, l_to);
UTL_SMTP. Data (l_mail_conn, 'single string message.' |) Chr (13));
UTL_SMTP. Quit (l_mail_conn);
END;
When I type the code above in sql * Plus, it does nothing but waiting just as if the code is incomplete and he expects something more! Could someone tell me what is the problem here?
Thank you
KamalHello
Try to put a / on a new line after END;
Concerning
Peter -
Run (or re-run) orders in the SQL * more buffer
I'm confused about sql / command. by defination, it run (or re-run) orders in the SQL * more buffer. How do I know if it execete or re - run a command?
for example, I run a select statement, seems that I have to type / for the result. When I run a create table statement, it seems to run twice with / and table I is error.
Someone could clearify when must - be used and when not to use it.As suggested Aman, that's the difference between a pl/sql block and a SQL statement (DDL or DML).
The semicolon is therefore not a part of SQL when you enter a statement SQL, SQL * Plus knows and will execute the statement as soon as she sees a point comma (which ends with the statement), or slash (run the buffer).
But a semicolon is a pl/sql statement terminator. So when you enter a pl/sql block, SQL * Plus keeps accepting lines of code until you have finished and then send the entire block to the database when you type a slash. This is also true when you enter CREATE PROCEDURE etc.
-
Does anyone know how to preserve the credibility of a string returned by using SQL * more variable substitution for use in a title column.
I am under SQL * more script and the output of the securities. I need to find out the name of the company (in the text name of the legal entity). However, the substitution variable returns / outputs the data to the correct record, but corrupts the content of the returned string by spaces dropping (necessary)?
In the script below, I tried several combinations to include using a technique of faking the output as a formula in Excel. It is very effective with the attack anywhere to Oracle/Microsoft problem at the output to Excel. For some varieties in solution, there are two methods to fill the Legal_Entity_Name which each produce the same corrupt result. I use method 2 because it's a little more friendly.
The output is directed to a local directory C:... If you try to run this script... note the output in the script path is c:\Ora_scripts\Corrupt_Example.xls coil;
In the database, EBS R12, the correct output should be: Industrias Selkirk of Mexico S de RL de CV . (IN THE SCRIPT, THE SAME SELECT STATEMENT IS USED AS THE MAIN QUERY - IT PRODUCES A CORRECT RESULT).
However, data is corrupted to: IndustriasSelkirkdeMexico.
Here's a testable script:
--@C:\Ora_Scripts\Corrupt_String_Script.SQL
trigger the echo
went to CHECK
moved the markup html off the coast of the coil
Leave your COMMENTS
Set trimspool on
delete columns
clear breaks
clear the buffer
Disable CALCULATED
TOPIC on the value
set PAGESIZE 50000
Set LINESIZE 500
NewPage 0 value
set TERMOUT off
-The variable definitions Section.
Undefine g_Registration_Id
Set g_Registration_Id = 12033;
Cancel the Instance definition;
Set the Instance = "XXXXXX";
Undefine Time_Stamp;
Define Time_Stamp = "DD-Mon-YYYY hh ';
Undefine sv_Legal_Entity_Name
Bnd_Legal_Entity_Name variable Char (75)
Variable bnd_Registration_Id number
--
-Fill in the title and the title of the data items.
-Company name get - method 1
/ * Start
Select xrg. Alternate_Registered_Name in: bnd_Legal_Entity_Name
of apps.xle_registrations xrg
where xrg. Source_Table = "XLE_ENTITY_PROFILES."
and xrg. Registration_Id = & g_Registration_Id;
End;
/
-Transfer the value of the variable binding to the variable substitution
Column sv_Var_1 sv_Legal_Entity_Name noprint new_value
Select: bnd_Legal_Entity_Name double sv_Var_1;
*/
--
-Company name method retrieves 2
Run: bnd_Registration_Id: = & g_Registration_Id;
Column sv_Legal_Entity_Name sv_Legal_Entity_Name FORMAT A75 noprint new_value
-Try in the form of Excel formula - no luck!
-Select ' = ' ' | xRG. Alternate_Registered_Name | «"«as sv_Legal_Entity_Name»»»
Select xrg. Alternate_Registered_Name as sv_Legal_Entity_Name
of apps.xle_registrations xrg
where xrg. Source_Table = "XLE_ENTITY_PROFILES."
and xrg. Registration_Id =: bnd_Registration_Id;
--
Column Instance_Col by Instance NOPRINT new_value
Select the name as Instance_COL in apps. Fnd_Apps_System;
--
Column Time_Stamp_Col new_value Time_Stamp NOPRINT
Select to_char (sysdate, "Mon-DD-YYYY HH24:MI:SS) as Time_Stamp_Col
From Dual;
--
the forage value off markup html on spool
coil c:\Ora_scripts\Corrupt_Example.xls;
TTITLE-
Skip - 0
'Arguments' left... »-
Jump - 1
Center & sv_Legal_Entity_Name-
Jump - 1
Right ' run: ' Time_Stamp-
Center "it is a centered string constant;
Jump - 2
-Various declaration of Variables.
the forage value off markup html on spool.
HEAD ' < title > example string of corrupt < /title >.
< style type = "text/css" >-
table {background: white; do-size: 80% ;}} -
Th {background: #ccc ;}} -
TD {padding: 0px ;}} -
< / style > '
-- Mainline query --
-REPLICATE THE SELECT USED TO DERIVE THE LEGAL_ENTITY_NAME TO THE TITLE
Select xrg. Alternate_Registered_Name
of apps.xle_registrations xrg
where xrg. Source_Table = "XLE_ENTITY_PROFILES."
and xrg. Registration_Id = & g_Registration_Id;
-Liquidation of script.
spool off;
moved the html markup;
Here is output (open in Excel):
Arguments... IndustriasSelkirkdeMexico It is a centered string
constantRun: 14 October 2014 10:10:45 ALTERNATE_REGISTERED_NAME Industrias Selkirk of Mexico S of CV RL Hello
Just use double quotes... First test: with x.sql container
trigger the echo
delete columns
TOPIC on the value
set PAGESIZE 50000
Set LINESIZE 500
NewPage 0 value
set TERMOUT off
-The variable definitions Section.
Undefine sv_Legal_Entity_Name
Column sv_Legal_Entity_Name sv_Legal_Entity_Name FORMAT A75 noprint new_value
TTITLE-
Skip - 0
'Arguments' left... »-
Jump - 1
Centre '& sv_Legal_Entity_Name ' -.
Skip 1
SELECT 'test ttitle' FROM dual;
running the script, providing a ttitle (slightly different from yours ;-), I have):
Industrias Belgica ;-) Selkirk ' TESTINGTTITLE
--------------
test ttitle
Best regards
Bruno Vroman.
-
SQL * more question: unprinted despite SET ECHO ON command
RDBMS Version: 11.2.0.4
OS: Oracle Linux 6.4 (bash shell)
I'm kinda a newbie to SQL * more.
Here's a SQL * Plus script embedded in bash script that scales multiple data files. This script has been run on the DB server side.
#! / bin/bash
export ORACLE_SID = ORCL1
echo "resize Datafile began to" 'date '.
sqlplus "/ as sysdba" < < EOF
set echo on
Set of feedback on
ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.338.834340223' resize 25g;
ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.337.834340223' resize 25g;
ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.336.834340225' resize 25g;
ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.335.834340225' resize 25g;
ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.334.834340225' resize 25g;
ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.333.834340225' resize 25g;
ALTER DATABASE DATAFILE '+ DATA/brfcsprd/datafile/manh_audit_lob.332.834340227' resize 25g;
quit smoking
EXPRESSIONS OF FOLKLORE
echo "resize Datafile ended in" 'date '.
As you can see, the SQL * more script contains ON SET ECHO ON and PUT your COMMENTS.
But in the logfile (see below), I don't see every ALTER DATABASE DATAFILE... command printing. I see that ' altered database.' printing messages.
I executed the script to nohup as
nohup resize.sh > MyResize2.log &
$ cat MyResize2.log
DataFile resize started at Sun Dec 29 00:09:45 MYT 2013
SQL * more: Production of the 11.2.0.4.0 on Sun Dec 29 00:09:45 version 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production
With partitioning, Real Application Clusters, Automatic Storage Management, OLAP,.
Options of Data Mining and Real Application Testing
SQL > SQL > SQL > SQL > SQL >
Database altered.
SQL >
Database altered.
SQL >
Database altered.
SQL >
Database altered.
SQL >
Database altered.
SQL >
Database altered.
SQL >
Database altered.
Hello
ECHO applies only to the SQL commands * Plus reads through the @ or the STARTUP command, no statements you type directly in the SQL > prompt or read the bash script statements.
Try to create a separate file, containing only the command ALTER DATABASE in a separate file (let's call it alter_database.sql for now) and call it from your script bash, like this:
#! / bin/bash
export ORACLE_SID = ORCL1
echo "resize Datafile began to" 'date '.
sqlplus "/ as sysdba".<>
set echo on
Set of feedback on
@whatever/alter_database
quit smoking
EXPRESSIONS OF FOLKLORE
echo "resize Datafile ended in" 'date '.
-
Windows system environment variables in "Sql * more»
Can I use/reference of Windows system environment variables in "Sql * more?
For example, I want to create sql-script runs in the database server computer that variable is "ORA_HOME", uses this value to perform a few sentences of sql/plsql.
Oracle 10g personal, Windows 7.
Edited by: CharlesRoos the 12.11.2010 17:28CharlesRoos wrote:
The business problem:
I created 2 databases in my computer. The two databases needs storage created by a script. The names of data files (.dbf files) of storage are the same for the two database. The two database has its own directory, where it holds data for the moment files. At the moment the data files for Database1 are in the folder something like '% ORACLE_HOME%"\oradata\%databasename1%\*.dbf and the second base of data has its data files in the other folder, somewhere '' % ORACLE_HOME%"\oradata\%databasename1%\*.dbf'. Now I want the script to create the tablespace called "INDX" with the same data file name "indx1.dbf" in the two database. If in the two documents mentioned the 'indx1.dbf' file must be created by the script. I think the script must do following:1. get ORACLE_HOME. 2. connect to database "databasename1" 3. EXECUTE IMMEDIATE "Create TableSpace INDX....file=%ORACLE_HOME% || databasename1 || indx1.dbf" 4. connect to database "databasename2" 5. EXECUTE IMMEDIATE "Create TableSpace INDX....file=%ORACLE_HOME% || databasename2 || indx1.dbf"
I don't have database Oracle close more, if the code was pseudo-code.
---
I do not understand how to use?-shortcut.
OK, my first impression is ' why must even be scripted? Creation of new spaces of storage is usually a one-off operation.
But what side this substitution of sqlplus command line variables. This example is Linux, but works on Windows with the change in the way environment variables are referenced:
* echo nix - $myvariable
Windows - echo myvariable %First of all, sqlscript to create the TS. Note the use of the substitution variable '& 1 '.
{code}
[oracle@vmlnx01 ~] $ cat makets.sql cat
set echo on the comments on check on trimsp on
Guest & 1
--
CREATE TABLESPACE EDSTEST PETIT_FICHIER
DATAFILE ' / ora01/oradata/&1/edstest.dbf'
SIZE 5 M
REUSE
AUTOEXTEND ON
NEXT 1280K
MAXSIZE 32767M
LOGGING
LOCAL MANAGEMENT MEASURE
SEGMENT SPACE MANAGEMENT AUTO
;
--
Drop tablespace edstest
including content and data files
;
output
{code}Thus, the OS invites: note that the @ is separated by a space, which makes a parm from command line instead of the part of the connection string
{code}
[oracle@vmlnx01 ~] $ export myparm = vlnxora1
[oracle@vmlnx01 ~] $ sqlplus system/pswd @makets $myparmSQL * more: Release 10.2.0.4.0 - Production on Fri Nov 12 18:13:05 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With partitioning, OLAP, Data Mining and Real Application Testing optionsSQL > prompt & 1
vlnxora1
SQL >--
SQL > CREATE TABLESPACE EDSTEST PETIT_FICHIER
2 DATAFILE ' / ora01/oradata/&1/edstest.dbf'
3 SIZE 5 M
4 REUSE
5 AUTOEXTEND ON
6. THE NEXT 1280K
7 MAXSIZE 32767M
8 LOGGING
MEASURE 9 LOCAL MANAGEMENT
10 SEGMENT SPACE MANAGEMENT AUTO
11;
2 old: DATAFILE ' / ora01/oradata/&1/edstest.dbf'
2 new: DATAFILE ' / ora01/oradata/vlnxora1/edstest.dbf'Created tablespace.
SQL >--
SQL > drop tablespace edstest
2 content and data files including
3;Tablespace has fallen.
SQL > exit
Disconnected from the database to Oracle 10 g Enterprise Edition Release 10.2.0.4.0 - Production
With partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@vmlnx01 ~] $
{code} -
How to see the result in sql * more
Hello
IAM running a procedure to sql * more...
I put quite a few DBMS .put line-out inside the proc for purporse debugging
before running, I said set serveroutput on;
the procedure is done correctly, but I don't see any output
It just displays the procedure completed successfully
How can I see the output
concerning
REDAHello reda,.
You are absolutely sure that the procedure actually runs one of these DBMS_OUTPUTs, that is, you are sure that alternate paths through your procedure are not taken?
To confirm, put a DBMS_OUTPUT at the very beginning of your procedure, to see if that print, which should be if you set serveroutput on it.
-
What is DOC comm in sql * more
Hello
I have connected the database as user scott and when I run the command 'DOC', it changed my sql * more environmental.
What is the use of the command of the DOC. In the sql * plus help its not available.
Any help from you.
Concerning
Balaji.MHello
SQl * more documentation, http://download-west.oracle.com/docs/cd/B12037_01/server.101/b12170/apc.htm#sthref3393
DOC [MSP] (obsolete)
Begins a block of documentation in a script.For more information about the method being inserted comments in a script, see the section "placing comments in Scripts" and the REMARK command.
After typing DOCUMENT and enter [return], SQL * Plus, the command prompt displays DOC > instead of SQL > until the end of the documentation. The ' ' pound (#) on a line by itself end the documentation.
If you have set the DOCUMENT to OFF, SQL * Plus suppresses the display of the block of documentation created by the DOCUMENT command. (See "SET DOC [MSP] {ON |}") {OFF} (obsolete) ")".
Concerning
Peter -
SQL * more the 'timing' in SQL Developer command
I installed SQL Developer version 4.1.1.19. In the sql worksheet, how can I use SQL * more order 'timing' in a script to see a time elapsed SQL? The "Timing" on 'set' did not return any info after running SQL, and 'calendar beginning mon_timer' back 'command Timing is obsolete. Help, please.
Thank you
- As you can see, there is no calendar information in the script output log.
- Then I tried on the discussion forum, found it can be enabled in "tool > preference > Database > startup script" and set as startup script:
Set serveroutput on
set timing on
- However, 2 questions are:
- the calendar that he returned is NOT the elapsed time of my stored procedure to run. He simply choose the 2 time points its time, before and not after MS point run. Set timing on is therefore not a solution for me.
- He did not follow the instructions in the startup script. After that I put the calendar in the startup script, stop & restart SQL Developer, same laptop charging, timing still on. The only way to turn off now is to configure it to NOT use
any startup script.
- Then I developed my own coding as a solution:
3. control of the COIL
VAR bv_start_ts VARCHAR2 (30)
VAR bv_end_ts VARCHAR2 (30)
VAR bv_elps_ts VARCHAR2 (30)
DECLARE
v_start_ts VARCHAR2 (30);
BEGIN
SELECT TO_CHAR (SYSTIMESTAMP, 'yyyymmddfxDyhh24miss.ff6') INTO v_start_ts FROM DUAL;
: bv_start_ts: = v_start_ts;
END;
/
IMPRESSION bv_start_ts
EXEC pmsmmi.rpt.rpt_ethncty_race_smry (15);
DECLARE
v_end_ts VARCHAR2 (30);
BEGIN
SELECT TO_CHAR (SYSTIMESTAMP, 'yyyymmddfxDyhh24miss.ff6') INTO v_end_ts FROM DUAL;
: bv_end_ts: = v_end_ts;
END;
/
IMPRESSION bv_end_ts
EXEC: bv_elps_ts: = TO_CHAR (TO_TIMESTAMP (: bv_end_ts, 'yyyymmddfxDyhh24miss.ff6')-TO_TIMESTAMP (: bv_start_ts, 'yyyymmddfxDyhh24miss.ff6'), 'hh:mi:ss.ff6');
IMPRESSION bv_elps_ts
SPOOL OFF
- Then I got what I want, the answer is in the 'PRINT ': bv_elps_ts
SQL > VAR bv_start_ts VARCHAR2 (30)
SQL > VAR bv_end_ts VARCHAR2 (30)
SQL > VAR bv_elps_ts VARCHAR2 (30)
SQL > DECLARE
v_start_ts VARCHAR2 (30);
BEGIN
SELECT TO_CHAR (SYSTIMESTAMP, 'yyyymmddfxDyhh24miss.ff6') INTO v_start_ts FROM DUAL;
: bv_start_ts: = v_start_ts;
END;
/
PL/SQL procedure successfully completed.
Elapsed time: 00:00:00.031
SQL > PRINT bv_start_ts
BV_START_TS
-----------
20150702Thu112617.775545
SQL > EXEC pmsmmi.rpt.rpt_ethncty_race_smry (15)
PL/SQL procedure successfully completed.
SQL > DECLARE
v_end_ts VARCHAR2 (30);
BEGIN
SELECT TO_CHAR (SYSTIMESTAMP, 'yyyymmddfxDyhh24miss.ff6') INTO v_end_ts FROM DUAL;
: bv_end_ts: = v_end_ts;
END;
/
PL/SQL procedure successfully completed.
Elapsed time: 00:00:00.062
SQL > PRINT bv_end_ts
BV_END_TS
---------
20150702Thu112630.805786
SQL > EXEC: bv_elps_ts: = TO_CHAR (TO_TIMESTAMP (: bv_end_ts, 'yyyymmddfxDyhh24miss.ff6')-TO_TIMESTAMP (: bv_start_ts, 'yyyymmddfxDyhh24miss.ff6'), 'hh:mi:ss.ff6')
PL/SQL procedure successfully completed.
SQL > PRINT bv_elps_ts
BV_ELPS_TS
----------
+ 00:00:13.030241000 000000
SQL > SPOOL OFF
-
SQL * more substitution vs bind variable question
Hi all, I am trying to automate some SQL within SQL codes * more script that is triggered by a script .bat, the only parts that change are Dates...
example:
create table blah as
Select * from table
WHERE DATE between start_date and END_DAY;
the DATE is a numeric field, YYYYMMDD
The script runs always at the beginning of a new week, so a Monday, unless a public holiday, then a Tuesday.
The END_DAY is * always * last Friday and I realized that:
variable L_FRIDAY char (15);
Start
Select to_char (next_day(sysdate-7,'FRIDAY'), 'YYYYMMDD') as Last_Friday in: double L_FRIDAY;
end;
/
The thing is that I get an error when I try to use the binding variable?
create table blah as
Select * from table
WHERE DATE between start_date and: L_FRIDAY;
Then once I found the end date, I was going to use add_months(L_FRIDAY,-12) for previous 12 months for the start_date...
When I tried to use a variable Substitution I could just hard code the date, but I can not or do not know how to set the value of this exec to the variable?
Help!
:-)
Basically my research reveals that - Bind variables are not allowed for operations of data definition, use substutions instead of bind variables
I need an automated way to find the END_DAY which is last Friday and START_DATE that is 12 months before Friday and refer to those in the SQL without errors.
Hello
Kodiak_Seattle wrote:
Hi all, I am trying to automate some SQL within SQL codes * more script that is triggered by a script .bat, the only parts that change are Dates...
example:
create table blah as
Select * from table
WHERE DATE between start_date and END_DAY;
the DATE is a numeric field, YYYYMMDD
The script runs always at the beginning of a new week, so a Monday, unless a public holiday, then a Tuesday.
The END_DAY is * always * last Friday and I realized that:
variable L_FRIDAY char (15);
Start
Select to_char (next_day(sysdate-7,'FRIDAY'), 'YYYYMMDD') as Last_Friday in: double L_FRIDAY;
end;
/
The thing is that I get an error when I try to use the binding variable?
create table blah as
Select * from table
WHERE DATE between start_date and: L_FRIDAY;
Then once I found the end date, I was going to use add_months(L_FRIDAY,-12) for previous 12 months for the start_date...
When I tried to use a variable Substitution I could just hard code the date, but I can not or do not know how to set the value of this exec to the variable?
Help!
:-)
Basically my research reveals that - Bind variables are not allowed for operations of data definition, use substutions instead of bind variables
I need an automated way to find the END_DAY which is last Friday and START_DATE that is 12 months before Friday and refer to those in the SQL without errors.
Or SQL * more bind variable or variable substitution can be DATEs. The best you can do is set a different type, as a string, representing a date. A string as June 19, 2015"represents a date, but so strings like 'SYSDATE' and ' SYSDATE - 7', so you can do something like this:
SET l_friday = ' NEXT_DAY ((SYSDATE-7), 'FRIDAY').
DEFINE start_date = "ADD_MONTHS (& l_friday, - 12)"
SELECT & start_date AS t_n
, & l_friday AS l_f
OF the double
;
Output (when executed on 25 June 2015):
L_F T_N
----------- -----------
June 19, 2014 19 June 2015
Maybe you are looking for
-
Why lonely will not work with Firefox 12?
Maps will not move alone
-
Is there a way to get a list of all applications / updates that are cached on your server?
Is there a way to get a list of all applications / updates that are cached on your server? Of course, we see the space that contains each category. But I would like a detailed list of the individual items that are actually cached. ITD be even bette
-
My child's account will not accept my own emails.
I can not account for my child to accept emails from my own account, even after "approved" it several times. How can I fix?
-
My laptop is Pavilion DV7-4045er (WY044EA #ACB). My motherboard was broken and I lost stickers of HP spares a long time ago. Can someone help me find:HP spare for my motherboard number;Number of HP spares for the whole left & right speakers & subwoof
-
may or may not? and what is the release date for ics 4.0.4? I use the xperia neo v