SQL & PL/SQL :: Execute Several Statements In One Command Of DataAdapter Class?
Jul 18, 2012
When working with SQL Server it's possible to execute several sql statements in one command of the DataAdapter in ADO.Net Now I try the same thing with an oracle database and recieve error ORA-00911: invalid character.
When remove ;character from query it again gives error- ORA-00933: SQL command not properly ended.
My query is like this-
update activity set activityname='Route Survey' where activityid=1;
SELECT * FROM activity where activityid=1
I have an table 'tbcontrol' where for each row I can have one or more sql statements (DML or DDL) in an column.
Example:
task | sql_scripts 1 | create table t1 (c1 number); insert into t1 (c1) values 100; 2 | create table t2 (c2 number); alter table t1 modify c1 not null default 0; 3 | alter table t2 modify c2 not null default 0; alter table t1 add c10 varchar2(10); create table t3 (c3 number not null default 0;
I need to create a procedure where I can pass an task number to execute the sql statements which are in the column 'sql_scripts'. Something like this:
create or replace sp_run_scripts (v_task number) is v_scripts varchar2(2000); begin select sql_scripts into v_scripts from tbcontrol where task = v_task execute immediate v_scripts; end;
But, here I'll have some problems:
- The script will have semicolons (EXECUTE IMMEDIATE doesn't support); - If I put a begin/end like a PL/SQL script, I can only run DML statements because DDL statements have implicit commit. - I can't use a cursor for execute each statement at a time because the scripts have multiples-rows. Even if I search for semicolons to 'separate' the scripts in the cursor (using SUBSTR and INSTR functions), I'll have problems with the semicolons between '' (quotations marks).
I want increase speed of importing data using ttisql. My script contains about 12k simular MERGEs. Can I prepare this state,ent once and later substitute params from script?
i`m trying to use pl/sql function to execute java class. I created 2 tables with around 100 values and java class with simple functionality. I need to create function to loop through my table1 and get with each iteration one value from table and pass that value as parameter to java class.
table1 is something like this:
ID NAME 1 name1 2 name2 3 name3 . . . . 100 name100
table2 is empty with same columns as table1 ( table2 is for data obtained from java returns ) I created in sql+ java class.
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "myClass" AS import java.io.*; import java.util.* public class myClass { public static String fun(String strName)
[code]....
Then i wanna make a pl/sql function for:
1)For i = 1 Obtain first value from table1 (column name) and pass it throught java class then return value and save it in table2 with the same id as id from table1
I am facing a problem regarding the execute immediate command. I have created a procedure as given below
SQL> set echo on ; SQL> set serveroutput on; SQL> declare 2 l_var varchar2(50); 3 sqlstring varchar2(3000); 4 begin [code].......
In this procedure the execute immediate command shows error ( if i avoid exception).I have tried other syntax too of this command but it is showing error only.
I have created a procedure, which should be executed on the below condition with EXECUTE IMMEDIATE COMMAND. But i am getting error.
The error shows the procedure/function name is not existing. But it is exist.
SQL> 1 Declare 2 a varchar2(20); 3 b varchar2(20); 4 c varchar2(1000); 5 begin 6 select to_char(sysdate,'day') into a 7 from dual; 8 select to_char(sysdate,'HH24') into b 9 from dual; 10 if 11 (a='friday' and b>=22) 12 or 13 (a='saturday' and b<=6) 14 or 15 (a='wednesday' and b>=9) 16 then 17 begin 18 EXECUTE IMMEDIATE ('begin'||BACKUP_AUTO_execute_bat_file||'end;'); 19 end; 20 else 21 null; 22 end if; 23* end; SQL> / EXECUTE IMMEDIATE ('begin'||BACKUP_AUTO_execute_bat_file||'end;'); * ERROR at line 18: ORA-06550: line 18, column 32: PLS-00222: no function with name 'BACKUP_AUTO_EXECUTE_BAT_FILE' exists in this scope ORA-06550: line 18, column 4: PL/SQL: Statement ignored
I'm on Oracle 11g R1. I've a requirement where user will be putting CSV files on Unix server and I've to create a job which runs periodically to check if any new file is added by user in the folder. If it finds a new file (s), then it needs to identify it and insert its name in an Oracle table. Once file's name is noted, it has to move file from that directory to another one.
I've created a Java class in my Oracle DB that calls a Visual Basic program to convert a XLS file into a CSV file in order to load it into an external table. The problem that I have is that when I call the Visual Basic program from the Java class, nothing happens. I had the same problem with a Python program, and I thought that the problem was from Python, but now with Visual Basic the problem remains, both aren't executed.
The strange thing is that when I call the same Java class outside Oracle, directly from a command line, it executes both Python and Visual Basic programs.
Here is the Java class defined in Oracle:
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "OSCommand" AS import java.io.*; public class OSCommand{ public static void Run(){ try {
[code]....
And here is the procedure that calls the Java class:
create or replace procedure run_os_command as language java name 'OSCommand.Run()';
I'm trying to install the Grid Infrastucture + Oracle db 11.2.0.3 on a Solaris 11. I'm used to work with Red-hat, so i don't remember in having such a problem. The issue is the following, when trying to run "runInstaller" as oracle user:
Checking Temp space: must be greater than 180 MB. Actual 1527 MB Passed Checking swap space: must be greater than 150 MB. Actual 2104 MB Passed Checking monitor: must be configured to display at least 256 colors >>> Could not execute auto check for display colors using command /usr/openwin/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<
Some requirement checks failed. You must fulfill these requirements before continuing with the installation,Continue? (y/n) [n] n
User Selected: NoDoing some researches, would be to install the SUNWxwplt package.i have installed all the required packages:
root@sol11:/mnt/sf_Compartilhamentos# pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibms SUNWpool SUNWpoolr SUNWsprot SUNWtoo SUNWlibm SUNWuiu8 SUNWfont-xorg-core SUNWfont-xorg-iso8859-1 SUNWmfrun SUNWxorg-client-programs SUNWxorg-clientlibs SUNWxwfsw SUNWxwplt system SUNWarc Lint Libraries (usr) system SUNWbtool CCS tools bundled with SunOS system SUNWfont-xorg-core X.Org Foundation X11 core fonts system SUNWfont-xorg-iso8859-1 X.Org Foundation X11 iso8859-1 fonts [code]....
xhost: unable to open display "192.168.0.20:0.0"I think i made all the necessary configurations (?).
When I execute multipath -ll command that time display only 3 path (orafra2,oradata2 and oradata1), not display other 2 path (orafra1 and data1). I have configure 5 path in /etc/multipath.conf file. What is the reason behind it.
Can we execute more than one insert statements at a time (eg 10) in database and givecommit at the end of insert statements or else give a commit one by one after each insert statements ?
we are running SAP application against oracle database. say, if I use brspace or brtools (from SAP side) to shutdown or startup database or collect stats, does this mean it not recommend to use oracle command to shutdown/start & collect stats?
I'm working with old code that uses dbms_sql.execute to build/execute dynamic sql. In our case, the user can select varying columns(I think up to 20) with different where conditions as needed.
After building the sql, here's an example
WITH ph AS (SELECT ph.* FROM po_header ph WHERE 1 = 2), pf AS (SELECT DISTINCT pf.order_id, pf.fund FROM po_fau pf, ph WHERE 1 = 1 AND ph.order_id = pf.order_id
[code]....
Where table records for
po_header = ~567746 po_fau = ~2153570
and PK "order_id" is a NUMBER(10) not null and a snippet of the code looks like
nDDL_Cursor := dbms_sql.open_cursor; dbms_sql.parse(nDDL_Cursor, sSQLStr, 2); FOR x IN 1 .. nCols LOOP sCols(x) := ''; dbms_sql.define_column(nDDL_Cursor, x, sCols(x), 100); END LOOP; nError := dbms_sql.execute(nDDL_cursor);
why when the "execute" statement is fired off the elapsed time takes ~4.5 seconds but If I change "1 = 1" above to "1 = 2" it takes ~.2 seconds. If I run the above query interactively it takes ~.2 seconds. Shouldn't the above query when joining
ph.order_id = pf.order_id
return zero rows back instantly or does the "dbms_sql_execute" do some other type of parsing internally that takes cpu time.
how to write a single query, Also i may add /delete school/class anytime. Query should support mesans everything dynamically should get the data.Even stored procedure will work for me.
I'm modifying a package which contains a function with different parameters (say cno, gno, pname etc) need to be passed though it and that function is called by the cursor later in the program. I need to create a cursor (select statement) for every class (a program set)...i.e. multiple select statements for a program set with different values. The parameters needed to be passed correspond to same columns in different tables...so do i have to refer those tables everytime i'm passing the parameters using a select statement? The Program accepts the parameters as an array (list of parameters) and returns a cursor and the program handles one program set (class) at a time. That parameter list will be in a loop..i.e. it will be repeated for every certain combination (say cno - pname combination). So ... How should i proceed and create a select statement with different parameters declared in the function of type string making it dynamic and returning them using ref cursor?
I deploy sound.java to sound,jar and the deployed process is completed Successfully. I also executed all the configuration steps required to use this class from "Orale9i form builder" and it's ok
The problem is:
When I tried to import "sound" class from "Oracle9i form builder" by clicking
Program----> Import Java Class-----> Oracle.forms.fd.sound Then an error has occurred:
Importing Class oracle.forms.fd.Sound... Exception occurred: java.lang.NoClassDefFoundError: oracle/forms/ui/VBean
I need to filter ticket prices according to the class; i.e.
CASE WHEN booking_class = 'Economy' THEN economy_saver ELSE 0 END AS ECONOMY_SAVER THEN economy_basic ELSE 0 END AS ECONOMY_BASIC THEN economy_basic_plus ELSE 0 END AS ECONOMY_BASIC_PLUSEND, CASE WHEN booking_class = 'Business' THEN business ELSE 0 END AS BUSINESS THEN business_flexible ELSE 0 END AS BUSINESS_FLEXIBLEEND.
..The objective is to show only the prices that belong to the selected class. I am not sure if my sql is correct at this point.
I have database 10.2.0.3 with one procedure that calls some java class loaded in database. Unfortunately I don't have source code of that java class or whole jar that was loaded into database.I would like to download it from database and try to decompile it.
how can I download some java classes from database? Everything I know is only the name of some java class that is used in one PL/SQL procedure (CREATE OR REPLACE PROCEDURE ..... AS LANGUAGE JAVA).
when I import java class from oracle forms (import java class ->> FFileChooser) appeared FFileChooser package but i don't know how use it how use OPEN_DIALOG or other function .
I am using Developer 10g R2. I have a form with two fields named input_value and output_value and a button named ok. I have a java class named Factorial which return the factorial of the input value. Now i want to use this class into pl/sql in ok button.
I need to add one validation in one form. The form is not getting run locally because of some imported java classes which was already there. From application server it works fine. When i run locally it gives ORA_JAVA.EXCEPTION_THROWN. Actually some trigger calls a procedure from this imported java class. Some path is specified in JNI.NEW_OBJECT(). That patg may not be in local system. If those files are included in our oracle home directory
I need to invoke a JavaMail code from oracle server. Conditions are :
On insertion of a row in a table a TRIGGER is to be run. This trigger would invoke a java code, that shoots an email, with desired credentials and login.
The code to send email, is based on JavaMail API, and is compiled on JVM version, 1.6.
The javaMail code can be loaded in oracle server using:
loadjava -user scott@TESTDB SendMailSSL.class
Another code doscmd.class is written and loaded in oracle, that is compiled in java 1.5. It is intended to call the SendMailSSL.class
In my PLSQL package ...How do I invoke this class file ?
So far I have done this ...
Declare abc ORA_JAVA.JOBJECT; xyz ORA_JAVA.JOBJECT; xxx VARCHAR2(25); value ORA_JAVA.JOBJECT; BEGIN
[code]...
I am getting an error saying the object type is wrong .... I would like to know how to assign a hardcoded value to the JOBJECT just to test before I continue.
Our system stores images on the unix filesystem. We scan full page images.
Our image specs are:
black and white: tiff, group4 compression, 300dpi. so files are about 40-80k compressed
photograpshs/gray scale: jpeg/jpeg compression 256 gray scale. Some images can be 2megs...but most of them are about 400-700k
We build a demo with forms10G/application server 1 year ago and performance was really bad. Took about 10-15 seconds to generate a report with 1 image of it...compared to about 1-2 secs using forms 6i. We just installed weblogic 11G (10.3.5) with forms 11gr2. I'm guessing performance will still be an issue but we will still be testing it.
Our users currently use nfs to access images on the unix server. So that would not changed.
- read_image from filesystem (c: unc path //server/images/.../1.jpeg)
- zoom in, zoom out (having vertical/hori scroll bars to move around...or best would be panning)
- save_image on filesystem
- fit to window/cancas
- always keeping aspect ratio
nice to have options, but not needed at this time
- save in blobs
- editing capabilities (mostly just select an area to delete, like black borders...some speckles here and there)
How to Pick / Extract the java class files from the database.? We have not maintained the latest codes in the oracle application server where java class code is residing.
All the Java Classes are available only in database. So we need to pick the latest java class code from production environment. In TOAD we tried but all class objects are listing at the left side but we are unable to take the code. So how can we take the latest codes(java classes) from the Production Database as a backup.
We can execute dynamic sql using both execute immediate and ref cursor..But what is the difference between the two and performance-wise which is better?
Most of my day to day work involves the support of DB2 on AIX and z/OS. I support the database infrastructure for one business system that runs on the Oracle RDBMS. The application is Oracle Transportation Management. The non-production environments don't get much traffic. If I sign into the TEST or DEV Enterprise Manager DB Control screen, the following warning is almost always listed on the main page:
Metrics "Database Time Spent Waiting (%)" is at 44.00384 for event class "Concurrency"
Enterprise Manager reports that this metric is continuously fluctuating above and below the warning threshold of 30% of db time when the environment is idle.To investigate(and I am no oracle expert, far from it), I ran the following:
SELECT * FROM v$session_event WHERE WAIT_CLASS='Concurrency' ORDER BY TOTAL_WAITS DESC;
By far, the top two entries in the result are the following: SIDEVENTTOTAL_WAITSTIME_WAITEDAVERAGE_WAITMAX_WAIT 124os thread startup12041423733.5218 359os thread startup150653433.5521 [code]...
Does this indicate a possible problem with the operating system?