About SQL script
I want to know the largest Sql scrpit that oracle permited.
example:
conn tiger
if I write select * from dept where deptid = 1 or deptid = 2 .... along with 10000 conditions .I want to know whether or not oracle permitted????
thankyou! 谢谢 --in chinese
or can you tell me how I can study about
this question.If you're really qurious, have a look through sql*plus documentation for possible limitations there. Or why not try for yourself?
Similar Messages
-
Is it possible to pass a TXT file as an input of a SQL script?
Dear all,
I have a question about SQL scripts running in SQL*Plus. I have a table including a list of SAP UserIDs. I would like to check for several people whether their
ID already exists. Here is how I proceed in my script file.
SELECT sap_userid
FROM SAPREF_USERS
WHERE (sap_userid
IN
'user1',
'user2',
'user3',
'user4',
'user5',
. /* So here I write one by one each userid. Consequently if a user already exists, the script will print his/her UserID */
GROUP BY sap_userid
ORDER BY sap_useridWell, this works, but I'm sure there should be a more intelligent method to do the job. If I put all UserIDs in a let's say a TXT file (one userid per line) is there
any way to pass this text file as an input for the script so I may get rid of the very long IN clause in my SQL query?
Thanks in advance,
Kind Regards,
DariyooshYet Another Post Without Version.
Typing 4 digits and 3 dots, or running select * from v$version and paste the result here
Qualifies as work, and the very reason you post here is you want to avoid to work, or to earn as much as possible by doing as little as possible.
In 9i and higher, the file is best treated as an external table, so the whole list of userids is replaced by
in (select * from external_table)
But this requires reading documentation, which again qualifies as ... work.
Ahh, most 'DBA's here are quite hopeless.
Sybrand Bakker
Senior Oracle DBA -
Question about creating new tables using SQL script in WebLogic Server
Hi,
I am new to WebLogic and I am following a book Java EE Development with Eclipse published by PACKT Publishing to learn
Java EE. I have installed Oracle Enterprise Pack for Eclipse on the PC and I am able to log into the WebLogic Server Administration Console
and set up a Data Source. However the next step is to create tables for the database. The book says that the tables can be created using
SQL script run from the SQL command line.
I cannot see any way of inputting SQL script into the WebLogic Server Admistration Console. Aslo there is no SQL Command line in DOS.
Thanks for your help.
Brian.Sounds like you are to run the scripts provided by a tutorial to create the tables, right? In that case, you may need to install an Oracle client to connect to your database. The client is automatically installed with the database, so if you have access to the server that hosts the database, you should be able to run SQLplus from there.
As far as I know, there is no way to run a script from the Admin Console. I could be wrong, however. -
Question about correctly EXIT on SQL Script
Hi there,
I have created a SQL script, every time when the raise_application error appears then of course the PL/SQL block ends but then still the external sql script is being executed, how can I prevent the External sql script from being executed after a raise application error is displayed?
Regards
RobH
DECLARE
BEGIN
IF start_date > stop_date
THEN
raise_application_error (-020110,
'Start Date can not be greater Stop Date. '
ELSE ..... do some selecting and inserting of data into temporary tables etc...
END IF;
END;
--And now a external SQL script should be started...
@c:\reports\test.sqlyou can trap your exception in the inner block using EXCEPTION block and from there propagate it to the external block to stop further processing. something like this...
DECLARE
l_deptno NUMBER;
BEGIN
FOR i IN (SELECT deptno FROM dept)
LOOP
BEGIN
FOR j IN (SELECT empno, ename FROM emp WHERE deptno = i.deptno)
LOOP
IF ( i.deptno = 20 ) THEN
RAISE_APPLICATION_ERROR(-20001, 'Error Raised');
ELSE
DBMS_OUTPUT.PUT_LINE('Dept = ' || i.deptno || ' EmpNo: ' || j.empno || ' EName: ' || j.ename);
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error Trapped Inside');
RAISE;
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error Trapped Outside');
END;
SQL> /
Dept = 10 EmpNo: 7782 EName: CLARK
Dept = 10 EmpNo: 7839 EName: KING
Dept = 10 EmpNo: 7934 EName: MILLER
Error Trapped Inside
Error Trapped Outside
PL/SQL procedure successfully completed. -
How to batch create SSO accounts from Windows or a PL/SQL script
We have just converted our 6i Forms and Reports to 10g (10.1.2.0.2), and run them against a 9i database. In order to be able to securely run reports we set up and configured SSO for a few accounts via the Oracle Identity Management Provisioning Console. We do not have PORTAL – nor do we want it. However, now we need to create about 500 SSO accounts at once. We would prefer to be able to create these accounts in a batch method – eg run something from Windows command line or run a PL/SQL script. We have the DBMS_LDAP package successfully installed in that 9i database. Currently our list of 500 users is simply in a table in the 9i db.
Spent several hours looking through both this site and Metalink, but so far no luck – especially because we don’t have or want PORTAL. If anyone can help, would appreciate it very much.
ThanksUser dbms_ldap package in the database to use PL SQL to create your database
account and then an OID account with a RAD to match the database login. If you
You may have to load the DBMS_Ldap package from the database ADMIN directory first to be available in the database.
LDAP SQL Ex.
user_username := LOWER(new_user) || '@domain.com'; -
retval := dbms_ldap.search_s(my_session, ldap_base,
dbms_ldap.scope_subtree, 'uid=' || user_username, my_attrs, 0,
my_message);
retval := dbms_ldap.count_entries(my_session, my_message);
my_entry := dbms_ldap.first_entry(my_session,my_message);
my_dn := dbms_ldap.get_dn(my_session,my_entry);
dbpassword := 'PASSWD01';
isvalidrad := forms_rad.newraddefinition(radname,new_user,dbpassword,
dbtnsnames,errormessage);
sessionestablished := forms_rad.createoidsession(ldap_user, ldap_passwd,
ldap_host, ldap_port, ldap_base);
radcreated := forms_rad.createradforcn(my_dn, 'false', errormessage);
-- Create new user's database account same as RAD account.
v_sql := 'CREATE USER "' || new_user || '" IDENTIFIED BY ' || dbpassword ||
' DEFAULT TABLESPACE JLIM TEMPORARY TABLESPACE TEMP';
EXECUTE IMMEDIATE v_sql;
v_sql := 'GRANT CONNECT TO ' || new_user;
EXECUTE IMMEDIATE v_sql; -
Mining Models used in SQL Developer 3.0 and models created PL/SQL scripts
Hi,
Pardon my ignorance if some of my questions are very basic. I am just gaining understanding about building/using mining models.
I installed sql developer and went thru some OBE exercises to build models ( classification models)
While building workflows the exercise required to supply data for the pre built models ( the four models pre-created). The question is - is this exercise is about building models or using models ?
How those pre-built models were created? Are these models are restricted in their usage. or are they generic models that they can be applied for solving similar problems?
What type of models can be used in workflows?
I am also seeing some smaples of pl/sql scripts used in creating some models. Is it correect to assume they are created using PL/SQL APIs ( DBMS_DATA_MINING, DBMS_DATA_MINING_TRANSFORM etc).
What is the differrence between these two model building process ?
ThanksHi,
The OBE exercises show you both how to build models and then to apply (Score) new data using the built models.
A model is always built using some form of input data, so it is built specifically with that form of data in mind.
It is not a generic model at all.
When you apply a model you provide data in the same format as the original data.
In the case of a Classification or Regression model, you are applying the model to generate a prediction on new data that conforms with the build data provided to the model.
The online help provides details on all the models that are available.
Data Miner uses the data mining pl/sql packages (package name DBMS_DATA_MINING) to create and test models.
There are also sql data mining prediction functions as well.
Thanks, Mark -
Calling sql script in plsql procedure
Hello,
I have a sql script named mytest.sql and i want to execute this from a stored procedure.
following is the contents of this script
spool d:\mytestsql.txt
select * from tab;
spool off
Actually i want my sql script to run daily to export some tables data.
I can execute this script from a sql prompt but i want to run it from enterprise manager.
I am using oracle 10gR2 on windows2000 system.
Any idea about scheduling the sql script to run automatically??
How to execute this sql script from a plsql procedure??
ThanksHi all,
Thanks for all the replies. I have found the solution with external procedures.
Following is the complete step by step guide.
1. Create the OSCommand Java Class using the following statement:
connect as any user:
create or replace and compile java source named oscommand as
import java.io.*;
public class OSCommand{
public static String Run(String Command){
try{
Runtime.getRuntime().exec(Command);
return("0");
catch (Exception e){
System.out.println("Error running command: " + Command +
"\n" + e.getMessage());
return(e.getMessage());
2. Create the following Wrapper Function using the following statement:
CREATE or REPLACE FUNCTION OSCommand_Run(Command IN STRING)
RETURN VARCHAR2 IS
LANGUAGE JAVA
NAME 'OSCommand.Run(java.lang.String) return int';
3. connect as sys
Execute dbms_java.grant_permission( 'FKHALID','SYS:java.io.FilePermission', '<<ALL FILES>>','execute');
execute dbms_java.grant_permission( 'FKHALID','SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '*' );
execute dbms_java.grant_permission( 'FKHALID','SYS:java.lang.RuntimePermission', 'readFileDescriptor', '*' );
commit;
note: here fkhalid is the oracle user.
connect as fkhalid user:
Declare
expdp_cmd Varchar2(2000);
Begin
expdp_cmd := OSCommand_Run('cmd /c sqlplus fkhalid@mtcedwt/pwd @d:\ORA_DUMPS\mydbexp.sql');
DBMS_OUTPUT.Put_Line(expdp_cmd);
End;
In Unix
Set Serverout On
Declare
x Varchar2(2000);
Begin
x := OSCommand_Run('/home/test/myoscommand.sh')
DBMS_OUTPUT.Put_Line(x);
End;
I will check the dbms_scheduler also and will let you know the results.
Thanks -
What is the easiest tool to debug an SQL script in Oracle XE environment?
I try to run a simple sql script that creates tables with their keys on Oracle XE. When it runs into bunch errors, I have difficult time to locate the mistake. One of the reason is, I don't know how to view the script in color that distinguishes the syntax like virtual C++ editor treats their text code.
Can XE do this? If not, is there any easier way to debug a script in its environment?
Much appreciated. Pardon for the triviality nature of the question.[PL/SQL Developer|http://www.allroundautomations.com/plsqldev.html] lets you step through a SQL*Plus-style script one command at a time.
SQL*Plus (Oracle's very basic command-line tool) has [WHENEVER OSERROR|http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12051.htm] and [WHENEVER SQLERROR|http://download-uk.oracle.com/docs/cd/B19306_01/server.102/b14357/ch12052.htm] settings that make it jump out of the script on OS or database failure, but that's about it. Other tools such as PL/SQL Developer, SQL Developer and (if you must) TOAD attempt to emulate SQL*Plus commands to some extent but you'd have to check the documentation to see what commands they support.
Scripts aren't a compiled programming language like C++ or PL/SQL so there is no interactive debugger. -
Using an SQL Script file to create database in Java? (monkeyDB.sql)
Hello!
I am a writing an SQL Script so that I can re-create my database on another server (im using my laptop to test it on first though).
I'm connecting to mySQL server using JDBC which works fine, but I was wondering
how can I run an entire script file, say myScript.sql from within a Java class??
(an SQL Script is simply a file containing the regular SQL commands and expressions that you might enter at an sql command line prompt)
example of an SQL Scritp: monkeyDB.sql>>
//#create new db
CREATE DATABASE sample_db;
//#set active db
USE sample_db;
//#set table paramaters
CREATE TABLE monkeys
(name CHAR(20),
age INT UNSIGNED,
sex ENUM('M','F')
//#create standard monkeys
INSERT INTO monkeys(name,age,sex) VALUES("Sammy",10,"M");
INSERT INTO monkeys(name,age,sex) VALUES("Muncht",12,"M");
INSERT INTO monkeys(name,age,sex) VALUES("Jill",8,"F");
//#get recordset
SELECT * FROM monkeys WHERE age < 50;Thanks for your help!thanks. :-)
I thought about that too but I didnt want to hard wire it into the code.
I guess it isnt possible to output the script file using some command from the sql library..? -
EDITING SQL SCRIPT IN CRYSTAL REPORTS
I just installed Version 12 and am trying to edit SQL scripts in Crystal Reports that were created in Version 8. When opening the Database tab on the Main Menu, the Query Panel is greyed out and not accessible. I can view the SQL Query but cannot edit it. If someone can advise me what to do I would be very appreciative.
Edited by: Frank Romano on Mar 18, 2009 4:17 PMHi Frank,
Here is the SAP Note that says that you cannot edit SQL from Crystal 9 and later
Symptom
In Crystal Reports (CR) 8.5 and earlier, it is possible to edit the SQL statement in the 'Show SQL Query' dialog box. Doing so allows the report designer to modify the SQL statement that CR generates. Starting with Crystal Reports version 9, users are no longer able to modify the SQL in the 'Show SQL Query' window.
How can you control the SQL statement that Crystal Reports sends to the database?
Resolution
To control the SQL statement that Crystal Reports 9 and later uses, use the 'Add Command' feature to create a Command Object. The 'Add Command' feature replaces the ability to edit SQL statements in the 'Show SQL Query' dialog box. Use this dialog box to write your own SQL command (query) which will be represented in Crystal Reports as a Table object.
More Information
Additional information about creating and using Command Objects ('Add Command') can be found on our support site and within the Online Help file contained in Crystal Reports.
On our support site search for the technical brief, cr_query_engine.pdf and knowledge base article c2016641 at
http://support.businessobjects.com/search
Keywords
OBJECT ADD COMMAND EDIT SHOW SQL QUERY DATABASE ACCESS MENU MODIFY SQL Crystal Reports Show SQL query Command object , c2017389
Regards,
Raghavendra -
When I run a sql script in unix using sqlplus command, the process halts at some point. No matter how long I wait, it does not finish (it does not bring the command prompt back). There are no problems in SQL*PLUS. This process usually takes about 30 mins when I run from SQL * PLUS. Any ideas why it hangs in UNIX?
sqlplus -s userid @script
ThanksAre you specifying a password ?
Have you set the ORACLE_SID ? -
Trouble calling .sql script
I have looked on the forum for about a half an hour and can't find the exact answer I'm searching for, so here goes.
I'm trying to update about a 100 records or so through use of an .sql script.
I put the following in my sql script file
UPDATE TABLE1 SET COL_NAME1 = 'some val.', COL_NUM_VAL = 12345, BOOL_VAL_COL = -1
WHERE AUTOID = 9554 OR AUTOID = 1082
OR AUTOID = 1305 OR AUTOID = 133
OR AUTOID = 9124
OR AUTOID = 8712
OR AUTOID = 55 OR AUTOID = 6741 OR AUTOID = 9881
OR AUTOID = 1012 OR AUTOID = 9158 OR AUTOID = 9378
OR AUTOID = 9101 OR AUTOID = 8351 OR AUTOID = 7110 OR AUTOID = 922 OR AUTOID = 732
OR AUTOID = 7253 OR AUTOID = 7825 OR AUTOID = 6772 OR AUTOID = 9854;
commit;however, I get some kind of message back in the SQL Plus prompt showing.
8 OR AUTOID = 9101 OR AUTOID = 8351 OR AUTOID = 7110 OR AUTOID = 922 OR AUTOID = 732
9 OR AUTOID = 7253 OR AUTOID = 7825 OR AUTOID = 6772 OR AUTOID = 9854
10* commit;
11 /I can't really discern from this output stmt what happened or what is wrong,
and needless to say, the update query doesn't execute. Any ideas as to what I need to put in there? And can't I just open it up in SQL Plus after I've created the sql file?Or is there more to it than that?
I welcome any feedback.
Thanks!
Message was edited by:
user515689Hi,
If you have a file called foo.sql that contains just the 10 lines of code that you posted, then you can run it from SQL*Plus by saying "@foo" (depending on where foo.sql is stored. You may actually have give the full path name: e.g.
SQL> @c:\my_folder\sub_folder\fooWhat are you doing to run the script?
By the way, instead of all those ORs you can use the IN operator:
UPDATE TABLE1 SET COL_NAME1 = 'some val.', COL_NUM_VAL = 12345, BOOL_VAL_COL = -1
WHERE AUTOID IN (9554, 1082, 1305, ..., 9854); -
SQL script to update details of Peoplesoft database
Hello all,
I'm a new DBA for a UK charity running both PS financials & HR that often needs to build test, training & dev instances from our production environments. Doing this currently requires a number of manual steps to update the various nodes & paths to those required for the new instance, and naturally I didn't become a DBA to do manual work ;-)
I'm looking to script these steps, but the PS schema being as it is, I'm not having a great deal of joy finding where the relevant data might be. If anyone had a script to do something similar, or could point me in the direction of the tables I'd be extremely grateful. The kind of things that we are currently having to do via the interface are:
Peopletools > Integration Broker > Integration Setup > Nodes
Peopletools > Security >Security Objects >Single Sign-on
Peopletools > Utilities > Administration > URLs
Peopletools > Integration Broker > Configuration > Quick Configuration > Integration Broker Domains
Peopletools > Portal > Node Definitions
Peopletools > Ren Server Configuration > Ren Server Cluster
We are running MS SQL Server, but any PL SQL scripts would be great - I just need to know which tables hold the data.
Many thanks,
AndyWell, it is very Peopletools version dependant.
An easy way could be to open to corresponding page you are talking about, then view the page definition and the associated record. At least this is what I use to do.
Then you update the background table and see if it is taking your new values.
To be short, here an extract of those tables (non-limited list, on PT.48) :
Single sign-on tructed node : pstrustnodes
Process scheduler definition : ps_serverdefn
Run control : psprcsruncntl
Message channels : pschnldefn
Messaging tables contents : psapmsgpub*, psapmsgsub*, psapmsgarc*
Message node definition : psmsgnodedefn
URL : psurldefn
Job definition : ps_prcsjobdefn
OPRID (email address) : psoprdefn
Then you should complete your own list with the method I gave above.
Nicolas. -
Report on Asset,SQl script
Hi Friends,
There is a urgent requirement in our project related to SQL queries. I don't have much knowledge on SQL/script. Need to write an script with the following requirements(asset.no,description,P.O no,location,person_in_charge). Please can anyone help on this
tqHello,
I tried already this report. But there is no information about the customer who baught the asset.
Any other solution ?
Edited by: Alexis.TN on Oct 12, 2009 12:44 PM -
Tracking the order of execution of sql scripts in SQL*Plus
In our production environment we sometimes have to run some .sql scripts in a particular order. Since the order of execution is important , i have created another .sql file caller caller.sql(shown at the bottom) which will call all the scripts in the right order.
i thought of putting a exec DBMS_LOCK.SLEEP (5); after the end of every execution of the script so that i can see the
'Ending script1'message .
The spooling within the caller script(execute_stack.log) has become meaningless because each script has a spool <filename.log> and spool off within it. These spool logs (for every script) is important for tracking purposes as each script belongs to a different development team and i have to send them the spooled log file after the execution.
I don't want to see the entire scripts running by in my screen. Since these scripts have their own spooling, i can later check the logs if the scripts where executed properly.
So i need two things.
1.I just need to see the following and nothing else in the screen.
Ending script1
Ending script2
Ending script3
.2. I need to log the order of execution. ie. the execute_stack.log should look like the above.Since there is a spool off within each script, this wouldn't be possible.Right?
Ending script1
Ending script2
Ending script3
.The caller.sql script which calls all the scripts in the right order
alter session set nls_date_format = 'DD-MON-YYYY hh24:MI:SS';
set serveroutput on
set echo on;
set feedback on;
spool execute_stack.log
@script1.sql
exec dbms_output.put_line ('Ending script1');
dbms_output.put_line(chr(10)||chr(10)||'.'||chr(10)||'.'||chr(10));
exec DBMS_LOCK.SLEEP (5);
@script2.sql
exec dbms_output.put_line ('Ending script2');
dbms_output.put_line(chr(10)||chr(10)||'.'||chr(10)||'.'||chr(10));
exec DBMS_LOCK.SLEEP (5);
@script3.sql
exec dbms_output.put_line ('Ending script3');
dbms_output.put_line(chr(10)||chr(10)||'.'||chr(10)||'.'||chr(10));
exec DBMS_LOCK.SLEEP (5);
@script4.sql
dbms_output.put_line(chr(10)||chr(10)||'.'||chr(10)||'.'||chr(10));
exec dbms_output.put_line ('Ending script3');
commit;
spool off;Is this a professional way of tracking the execution of .sql scripts?Pete_Sg1 wrote:
Is this a professional way of tracking the execution of .sql scripts?No. There is very little professional about using .sql scripts on a production system - when stored procedures are safer, more robust, easier managed and controlled and secure.. and where a log table can be used to properly log the runtimes (and other stats) of each processing step.
Let's just take a look at the number of moving parts you need to schedule and run a .sql script. A cron job needs to be configured with the proper environment setting. It needs to run a shell script. That shell script needs to load SQL*Plus. SQL*Plus needs to connect to the database (starting a dedicated server process most likely). SQL*Plus then needs to read a .sql file, parse these commands and either execute these locally (SQL*Plus commands) or remotely (PL/SQL and SQL commands).
How can this be considered professional when the very same can be achieved with a
- stored procedure
- using DBMS_JOB to schedule the procedure for execution
There are so many things that can go wrong with the first method. And so few things that could go wrong with the last one. No contest as to which method is not only better, but also professional.
PS. See that you use Windows to run these scripts. It is even worse as it introduces another hardware and software layer making the scenario even more insecure & unsafe with more moving parts that can go wrong or simply fail.
Maybe you are looking for
-
Photoshop CS4 / Windows7 Print Shrinkage
Okay, this is driving me nuts. I had created a document with Photoshop CS4 on Windows XP Professional to the following: 8-1/2" x 11" at 300dpi, cmyk. It printed fine on the network printer (xerox phaser 7760dx ps) for weeks. Two weeks ago I was upgra
-
Error in opening logic song files
I`ve recorded audio files into song folder and have problems reopening the logic song folder -keep getting error window saying it does not recognise the file type .this is very frustrating.occasionally it will open up . I`m trying from within logic f
-
3G S stocked in Apple Stores on Saturday?
Did any of you today get a sense, hear, or ask if the Apple stores you were at sold out of their iPhones today? Did any of them say they would have more for Saturday? Any word on whether 16GB or 32GB or BOTH were selling/sold out? I just ordered mine
-
Expt/Imp Proce & Buss.Transaction Type for Foreign Trade for Puchase order
Hello All, I need to get the EIPO-EXPRF(Export/Import Procedure for Foreign Trade) and EIPO-EXART(Business Transaction Type for Foreign Trade) for Purchase Order. Is there any function module available for this. To get the same information (EIPO-EXPR
-
Hide button 'Group' 'Organisation' in transaction BP
Hello all, is it possible to hide the button - Organization: Create Organiztaion - Group: Create Group in the transaction BP. Thanks