Execute a string containing a PL/SQL block
Hi,
I would like to build a string containing a PL/SQL block and execute it dynamically. Is there way to do this.
Note - The reason I want to this is because, based on certain table data dictionary views the declaration section of the PL/SQL block that I am building might vary
I tried to use EXECUTE IMMEDIATE, it didn't work, pls let me know if I am missing something.
DECLARE
v_str VARCHAR2(1000);
BEGIN
v_str := 'BEGIN NULL; END';
EXECUTE IMMEDIATE v_str;
END;
/
Hi,
Just happened to find it. EXECUTE IMMEDIATE can be used, the bug with my code was I didn't have a ; after the END statement. Corrected code is below, thanks for your time
DECLARE
v_str VARCHAR2(1000);
BEGIN
v_str := 'BEGIN NULL; END;';
EXECUTE IMMEDIATE v_str;
END;
/
Similar Messages
-
Get first word in string containing '-' using T-SQL
I'm trying to update a column in a table by inserting the first word (that has hyphen) in another column. I'm trying this:
UPDATE DSoil
SET SoilName column = first word of MapUnit column (Only if the first word has '-' character).
Appreciate any help.
Marilyn GamboneDECLARE @myTable TABLE (MapUnit Varchar(100), SoilName Varchar(100) Null)
INSERT INTO @myTable (MapUnit)
VALUES ('Test'), ('test-1'), ('-abc test')
UPDATE @myTable
SET SoilName = (CASE WHEN CHARINDEX('-', MapUnit) <> 0 THEN SUBSTRING(MapUnit, 1, (CASE WHEN CHARINDEX(' ', MapUnit) = 0 THEN LEN(MapUnit) ELSE CHARINDEX(' ', MapUnit) END)) ELSE SoilName END)
SELECT * FROM @myTable
--output
MapUnit SoilName
"Test" NULL
"test-1" test-1
"-abc test" -abc
Best Wishes, Arbi; Please vote if you find this posting was helpful or Mark it as answered. -
How to re-execute anonymous PL/SQL block in package definition ?
Hi all,
I implemented a package which contains procedures and an anonymous PL/SQL block.
This anonymous PL/SQL block is executed only once when the package is called.
and charge in-memory the content of table to avoid multiple SQL access each
time one procedure is called.
As my application open many sessions to the Oracle database, I would like to try
a solution to signal all sessions to reload the content of table when the content
of table is modified. The solution to stop and to restart the connection is not
acceptable.
Best regards
Sylvain> .. to avoid multiple SQL access each time one procedure is called.
As I understand your posting, this is the actual technical requirement. You want to force serialisation of PL/SQL code. Correct? (only one session at a time can run the procedure)
This feature typically used to accomplish this in o/s code is called a semaphore. PL/SQL does not specifically support semaphores. However, it supports a range of IPC (Inter Process Communication) methods - from message queues to pipes.
One of these IPC interfaces is DBMS_LOCK - which allows a unique lock to be defined and processes to manage their resource usage/execution/etc via this lock using the DBMS_LOCK API.
I've found this a pretty clean and manageable solution to enforce serialisation. Of course, it is even better not to enforce serialisation. Rather design the code to be thread safe and capable of multi-processing/parallel processing.
Personally, I would not use a table as an IPC mechanism as Oracle already provides better IPC mechanisms for PL/SQL code. As for "signalling sessions to re-load the table" - not possible as Oracle sessions cannot register callbacks to handle events. Oracle sessions are not event driven processes from a PL/SQL (application development) perspective. -
Execute PL/SQL block with named binds from within java code?
Hi guys,
Is there any good way to execute my PL/SQL code, for example
BEGIN :x := :x+1; END;
from my Java code? I need nothing complicated, just static code block with named binds.
I have tried the Oracle exetnded JDBC (setXXXbyName methods):
public static void main(String[] args){ try { Class.forName("oracle.jdbc.driver.OracleConnection"); Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user","password"); String SQL="begin :x:=:x+1; end;"; OracleCallableStatement stmt; stmt=(OracleCallableStatement)conn.prepareCall(SQL); stmt.setIntAtName("x", 5); stmt.registerOutParameter("x", Types.INTEGER); stmt.execute(); System.out.println(stmt.getInt("x")); } catch (Exception x) { x.printStackTrace(); } }
And get the java.sql.SQLException: operation not allowed: Ordinal binding and Named binding cannot be combined!
Then i've tried SQLJ appoach:
public static void main(String[] args){ try { Class.forName("oracle.jdbc.driver.OracleConnection"); Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user","password"); Oracle.connect(conn); System.out.println("Connected!"); int x=3; #sql { BEGIN :x := :x+1; END; }; System.out.println("x=" + x); } catch (Exception x) { x.printStackTrace(); } }
And x=3 had retuned... Although 4 expected.
Then, I've set parameter sqlj.bind-by-identifier=true
And result is another exception! java.sql.SQLException: Missing IN or OUT parameter at index:: 2
Can you please mark my mistakes/point to correct solution?
Thanks in advance,
AlexeyFound another solution, this time working at least...
public void testPLSQL() {
String dynamicSQL=
"declare\n" +
" v_CursorID INTEGER;\n" +
" v_BlockStr VARCHAR2(500);\n" +
" v_Dummy INTEGER;\n" +
" v_x String(18);\n" +
"BEGIN\n" +
" v_CursorID := DBMS_SQL.OPEN_CURSOR;\n" +
" v_BlockStr :=?;" +
" DBMS_SQL.PARSE(v_CursorID, v_BlockStr, DBMS_SQL.V7);\n" +
" v_x:=?;"+
" DBMS_SQL.BIND_VARIABLE(v_CursorID, ':x', v_x,18);\n" +
" v_Dummy := DBMS_SQL.EXECUTE(v_CursorID);\n" +
" DBMS_SQL.VARIABLE_VALUE(v_CursorID, ':x', v_x);\n" +
" DBMS_SQL.CLOSE_CURSOR(v_CursorID);\n" +
" ?:=v_x;"+
" COMMIT;\n" +
"EXCEPTION\n" +
" WHEN OTHERS THEN\n" +
" DBMS_SQL.CLOSE_CURSOR(v_CursorID);\n" +
" RAISE;\n" +
"END DynamicPLSQL;";
try {
Class.forName("oracle.jdbc.driver.OracleConnection");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","user", "password");
System.out.println("Profit");
String SQL="begin :x:=:x+1; end;";
OracleCallableStatement stmt;
stmt=(OracleCallableStatement)conn.prepareCall(dynamicSQL);
stmt.setString(1, SQL);
int x=3;
stmt.setInt(2, x);
stmt.registerOutParameter(3, Types.INTEGER);
stmt.execute();
x=stmt.getInt(3);
System.out.println(x);
assertEquals(4, x);
} catch (Exception ex) {
ex.printStackTrace();
assertTrue(false);
}Now the only thing I need is to code some kind of preprocessor of SQL block, to prepare the dynamicSQL lair for SQL critter...
Please please please show me something less complicated! :8} -
How to execute pl/sql block from a file
hi all,
can anybody tell me how to execute a pl/sql block from a file.it wont contain any procedures.it is of the form
--begin
--declare
--end;
ThanxHere is the file
File is stored in C Drive (Windows Environment)
declare
x number;
begin
select 1 into x from dual;
dbms_output.put_line(x);
end;
SQL> @c:\t.sql;
1
PL/SQL procedure successfully completed.Are you facing any issues?
Regards,
Bhushan -
Can't create a sequence within a pl/sql block with execute immediate.
Hi All. I created a user and granted it the 'create sequence' privilege though a role. In a pl/sql block I try to create a sequence using 'execute immediate' but get a 1031-insufficient privileges error. If I grant create sequence directly to the user, the pl/sql block completes successfully. Can anyone explain this behavior? We're running 11.2 Enterprise Editon.
Thanks,
MarkIn a definer's rights stored procedure (the default), you only have access to privileges that have been granted directly, not via a role.
There are two basic reasons for that. First, roles can be enabled or disabled, default and non-default, password-protected, etc. so the set of roles a particular user actually has is session-specific. Oracle needs to know at compile time what privileges the owner of the procedure has. The only way to do that (without deferring the privilege check) is to ignore privileges granted through roles.
Second, since 99% of privilege management DBAs do involves granting and revoking roles, it's helpful that changing role privileges will never cause objects to be marked invalid and recompiled which can have side-effects on applications. DBAs only need to worry about causing problems on those rare cases where they are granting or revoking direct privileges to users.
You can create an invoker's rights stored procedure by adding the clause (AUTHID CURRENT_USER). That defer's the security check to run-time but allows the procedure to see privileges granted through roles in the current session. But that means that the caller of the procedure would need to have the CREATE SEQUENCE privilege through the role, not the owner of the procedure.
And just to make the point, dynamic object creation in PL/SQL is almost always a red flag that there is something problematic in your design. If you are creating sequences dynamically, that means that you'd have to refer to them dynamically throughout your code which means that your inserts would need to use dynamic SQL. That's not a particularly easy or safe way to develop code.
Justin -
Obtaining a collection as a return from an execute immediate pl/sql block
version 10.2
I need to obtain the collection back from the execute immediate of a pl/sql block:
procedure block(owner varchar2) is
stmt long;
objecttab_coll dbms_stats.objecttab;
begin
stmt := '
begin
dbms_stats.gather_schema_stats(''' || owner || '''
,options => ''LIST AUTO''
,objlist => :objecttab_coll
end;';
execute immediate stmt returning into objecttab_coll;
-- do more stuff here
end block;I have tried this + a few variations but with no luck. In looking through the docs I do not see an example. can this be done?
Thanks
OxI dont find any need for an execute immediate here. This must be just enough.
procedure block(owner varchar2)
is
objecttab_coll dbms_stats.objecttab;
begin
dbms_stats.gather_schema_stats(ownname => owner, options => 'LIST AUTO', objlist => objecttab_coll);
-- do more stuff here
end block;Thanks,
Karthick. -
Hii All,
I'm facing the following error
ERROR at line 66:
ORA-06550: line 66, column 20:
PLS-00306: wrong number or types of arguments in call to '||'
ORA-06550: line 66, column 11:
PL/SQL: Statement ignoredVersion Details
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for Solaris: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - ProductionMy pl sql block
Declare
p_table_name clob := 'CP_CA_DTLS' ;
Type t_column_name_tab is table of varchar2(4000)
index by binary_integer;
l_table_tab t_column_name_tab;
l_file_name constant varchar2(5000) := 'column_counts';
l_count number;
l_tab_count number;
l_str varchar2(32000);
l_tbl_str varchar2(32000);
Cursor c_table_columns(c_table_name user_tables.table_name%type)
Is
Select column_name
from user_tab_cols
where table_name = upper(c_table_name);
Type t_table_columns is table of c_table_columns%rowtype;
l_column_name_tab t_table_columns;
Begin
--Splitting comma seperated data
Select regexp_substr(p_table_name,'[^,]+{1}',1,level)
bulk collect into l_table_tab
from dual
connect by level <= length(regexp_replace(p_table_name,'[^,]*'))+1;
for k in 1..l_table_tab.count
loop
-- dbg_print(l_file_name,'***'||l_table_tab(k)||'***');
Begin
l_tbl_str := 'Select count(*) from '||l_table_tab(k);
execute immediate l_tbl_str into l_tab_count;
-- dbg_print(l_file_name,'Overall Count of table '||l_table_tab(k)||' is '||l_tab_count);
End;
-- dbg_print(l_file_name,'Column Name '||','||'Count');
Open c_table_columns(l_table_tab(k));
loop
Fetch c_table_columns bulk collect into l_column_name_tab limit 50;
exit when l_column_name_tab.count = 0;
dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
for i in 1..l_column_name_tab.count
loop
Begin
l_str := 'Select count(*) ' ;
l_str := l_str||' from '||l_table_tab(k) ;
l_str := l_str||' where '||l_column_name_tab(i);
l_str := l_str||' is null' ;
Execute Immediate l_str into l_count;
End;
--dbg_print(l_file_name,l_column_name_tab(i)||','||l_count);
end loop;
end loop;
Close c_table_columns;
end loop;
dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
End;Even I'm not able to print l_column_name_tab(i) using dbms_output.
(Later I came to know that this information can be achieved using user_tab_col_statistics table)
But would like to know whats wrong with my code.???
Plz help me .
Edited by: 792353 on Dec 3, 2010 1:26 AMHii RDB,
when I comment this part of code
-- l_str := l_str||' where '||l_column_name_tab(i);
-- l_str := l_str||' is null' ;
SQL> Declare
2
3
4 p_table_name clob := 'CP_CA_DTLS' ;
5
6 Type t_column_name_tab is table of varchar2(4000)
7 index by binary_integer;
8
9 l_table_tab t_column_name_tab;
10
11
12
13
14 l_file_name constant varchar2(5000) := 'column_counts';
15 l_count number;
16 l_tab_count number;
17 l_str varchar2(32000);
18 l_tbl_str varchar2(32000);
19
20 Cursor c_table_columns(c_table_name user_tables.table_name%type)
21 Is
22 Select column_name
23 from user_tab_cols
24 where table_name = upper(c_table_name);
25
26
27 Type t_table_columns is table of c_table_columns%rowtype;
28
29
30 l_column_name_tab t_table_columns;
31
32 Begin
33 --Splitting comma seperated data
34
35 Select regexp_substr(p_table_name,'[^,]+{1}',1,level)
36 bulk collect into l_table_tab
37 from dual
38 connect by level <= length(regexp_replace(p_table_name,'[^,]*'))+1;
39
40 for k in 1..l_table_tab.count
41 loop
42 -- dbg_print(l_file_name,'***'||l_table_tab(k)||'***');
43
44 Begin
45 l_tbl_str := 'Select count(*) from '||l_table_tab(k);
46
47 execute immediate l_tbl_str into l_tab_count;
48
49 -- dbg_print(l_file_name,'Overall Count of table '||l_table_tab(k)||' is '||l_tab_coun
t);
50
51 End;
52
53 -- dbg_print(l_file_name,'Column Name '||','||'Count');
54
55 Open c_table_columns(l_table_tab(k));
56 loop
57 Fetch c_table_columns bulk collect into l_column_name_tab limit 50;
58 exit when l_column_name_tab.count = 0;
59 dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
60 for i in 1..l_column_name_tab.count
61 loop
62
63 Begin
64 l_str := 'Select count(*) ' ;
65 l_str := l_str||' from '||l_table_tab(k) ;
66 -- l_str := l_str||' where '||l_column_name_tab(i);
67 -- l_str := l_str||' is null' ;
68
69 Execute Immediate l_str into l_count;
70
71 End;
72
73 --dbg_print(l_file_name,l_column_name_tab(i)||','||l_count);
74
75 end loop;
76 end loop;
77 Close c_table_columns;
78 end loop;
79
80 dbms_output.put_line('l_column_name_tab.count count is : '||l_column_name_tab.count);
81 End;
82 /
PL/SQL procedure successfully completed.its running fine so the problem is l_column_name_tab(i) !!!!!!
and there is nothing wrong with l_table_tab(k) and its declaration.
Edited by: 792353 on Dec 3, 2010 2:17 AM -
Using PL/SQL Block how do you check if the character string value is aA-zZ
I have a pl/sql block that I prompt the user for password and I load the string into an array and interrogate each index(entry) to see if it is "aA-zZ".
How can I check if the value entered is Alpha.
I need to do the same for number and Special character. Please advise. ThanksThanks to All of you. The desired solution to verify complex password that enforces desired security policies. An example that I am using is the following:
IF NOT (regexp_like(sz_complex_pw,'[[:digit:]]') AND regexp_like(sz_complex_pw,'[[:alpha:]]') AND regexp_like(sz_complex_pw,'[[:punct:]]') AND regexp_like(sz_complex_pw,'[[:upper:]]'))
THEN
--dbms_output.put_line('Password is not complex...');
RAISE sz_err_pw_complex; -- Complex Password is not compliant
END IF;
DBMS_OUTPUT.PUT_LINE('Complex Password is in Compliance...');
EXCEPTION
This was helpful to me and I trust others will find helpful.
Edited by: yakub21 on Oct 16, 2010 9:05 PM -
Comma delimeted string in IN clause of PL/SQL block
Hi,
I am using string having comma separted string in IN clause of PL/SQL block.
But it does not give me right result.
If i m using sql query then give me result.
I m using oracl 10g and following code. DEPT table having 'miller' and 'cleark' ename rows.
Can you please suggest the other way to get proper result.
declare
cnt number:=0;
strin varchar2(40);
begin
strin:='miller,cleark';
select count(*)
into cnt
from dept
where ename in (strin);
dbms_output.put_line('cnt:-'||cnt);
end;Thanks.Apart from the solutions you've already been given, let's be clear...
user548963 wrote:
I am using string having comma separted string in IN clause of PL/SQL block.
But it does not give me right result.Yes it does, it's giving exactly the expected result for what you have provided. It may not be what you're desiring, but it's absolutely correct.
The IN Clause is expecting multiple arguments to be in the set of data. You are providing it with a single argument... a single string. Just because your string has got commas in it does not make that string into multiple arguments. -
Execute immediate will work in SQL Block in shell script?
Hi Friends,
i am wirting script to get the account id's corresponding to CIF from oracle table and need to pass to procedure.
Here first_org and last_org are shell variables.
When i execute the below program it is throwing execute not found.
Can you please correct me where i made a mistake? and also please let me know how to display some content in below sql block ?dbms_output.put_line or print which need to use and provide me the syntax for both.
`sqlplus -s crmuser/******@dotis11<<ENDOFSQL
whenever sqlerror exit 1
declare
qstr varchar2(200);
facid varchar2(20);
Lacid varchar2(20);
begin
qstr:='select ACCOUNTID from accounts where ORGKEY=:1';
execute immediate qstr into facid using $first_org;
dbms_output.put_line(facid);
qstr:='select ACCOUNTID from accounts where ORGKEY=:1';
execute immediate qstr into Lacid using $last_org;
dbms_output.put_line(Lacid);
exec Retail_Otu_Dedup_Account(facid,Lacid)
end;
exit;
ENDOFSQL`
Thanks,
Venkat Vadlamudi.Hi SY,
I Included set serveroutput on but i didn't include single quotes for shell variable in execute immediate.
Now iam able to execute and getting proper o/p.
Thanks SY for your help...
and how to print shell variable in above sql block..i tried like this. but throwing error.
dbms_output.put_line('$first_org');
dbms_output.put_line('VCIF1320');
ERROR at line 5:
ORA-06550: line 5, column 12:
PLS-00103: Encountered the symbol "." when expecting one of the following:
constant exception <an identifier>
*<a double-quoted delimited-identifier> table long double ref*
char time timestamp interval date binary national character
nchar
The symbol "<an identifier>" was substituted for "." to continue.
ORA-06550: line 6, column 5:
PLS-00103: Encountered the symbol "=" when expecting one of the following:
constant exception <an identifier>
*<a double-quoted delimited-identifier> table long double ref*
char time timestamp interval date binary national characte
Thanks,
Venkat Vadlamudi. -
While executing the following pl/sql block Iam getting following error
While executing the following pl/sql block
Iam getting following error
ORA-06550: line 5, column 11:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 5, column 11:
PL/SQL: Item ignored
declare
TYPE t_customer_details IS REF CURSOR;
o_customer_details t_customer_details;
v_rec o_customer_details%ROWTYPE;
begin
o_customer_details:=pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329);
LOOP
FETCH o_customer_details INTO rec ;
EXIT WHEN o_customer_details%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(' print' );
END LOOP;
CLOSE o_customer_details;
end;sorry
declare
TYPE t_customer_details IS REF CURSOR;
o_customer_details t_customer_details;
begin
o_customer_details:= pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329);
FOR v_rec IN o_customer_details
LOOP
DBMS_OUTPUT.PUT_LINE(' print' );
END LOOP;
END;I changed code,
Can you say , o_customer_details:= pkg_search.fngetcustdetails( 2727,1000841, NULL,NULL,119105329); is it right?
pkg_search.fngetcustdetails return ref cursor?? -
Pl/sql block to count no of vowels and consonents in a given string
hi,
I need a pl/sql block to count no of vowels and consonants in a given string.
Program should prompt user to enter string and should print no of vowels and consonants in the given string.
Regards
KrishnaEdit, correction to my above post which was wrong
SQL> ed
Wrote file afiedt.buf
1 with t as (select '&required_string' as txt from dual)
2 --
3 select length(regexp_replace(txt,'([bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ])|.','\1')) as cons_count
4 ,length(regexp_replace(txt,'([aeiouAEIOU])|.','\1')) as vowel_count
5* from t
SQL> /
Enter value for required_string: This is my text string with vowels and consonants
old 1: with t as (select '&required_string' as txt from dual)
new 1: with t as (select 'This is my text string with vowels and consonants' as txt from dual)
CONS_COUNT VOWEL_COUNT
30 11
SQL> -
Accepting user input and executing a PL/SQL block using it
Hi All,
I am working on a requirement wherein I have to accept values from the user for the various arguments to be supplied to a PL/SQL block and then execute it using these values. For now, I am using the following logic:
PROMPT Enter value for the Category
ACCEPT cCategory CHAR PROMPT 'Category:'
DECLARE
cCategry CHAR(1) := '&cCategory';
BEGIN
DBMS_OUTPUT.PUT_LINE('The value of the Category as entered by you is' || cCategory);
END;
PROMPT Press y if you want to proceed with the current values, or press n if you want to re-enter the values
ACCEPT cChoice CHAR Prompt 'Enter y or n:'
DECLARE
cCategry CHAR(1) := '&cCategory';
sErrorCd VARCHAR2(256);
sErrorDsc VARCHAR2(256);
BEGIN
IF '&cChoice' = 'y'
THEN
DBMS_OUTPUT.PUT_LINE('Starting with the process to execute the stored proc');
--- schema1.package1.sp1(cCategry, sErrorCd, sErrorDsc);
--- DBMS_OUTPUT.PUT_LINE('Error Code :' || sErrorCd);
--- DBMS_OUTPUT.PUT_LINE(' Error Description :' || sErrorDsc);
ELSIF '&cChoice' = 'n'
THEN
Now I want that the proc again start executing in the loop from the 1st line i.e. PROMPT Enter value for the Category. However i see that this is not possible to do that PROMPT statements and accepting user inputs execute only on the SQL prompt and not inside a PL/SQL block.
Is there an alternate method to establish this?
Thanks in advance.Hi,
You can write a genric procedure to achive the desired output. Pass 'Y' or 'N' in the procedure.
Call that procedure in simple pl/sql block during runtime using substituton operator.
For ex
create or replace procedure p1(category_in in varchar2)
IS
BEGIN
if (category_in='Y')
then
prcdr1()
/** Write your logic here ***/
elsif(category_in='N') then
prcdr2()
/** write your logic here***/
end if;
exception
/***write the exception logic ***/
end p1;
Begin
p1('&cat');
end;Regards,
Achyut K
Edited by: Achyut K on Aug 6, 2010 5:20 AM -
Executing a PL/SQL block (using Toplink)
I have a scenario where I need to execute some fairly complex PL/SQL blocks. As a tester, I am attempting to execute the following simple block:
declare val NUMBER := 1; begin val := 2; end;
Both wrapping this in an SQLCall, or a DataReadQuery give the following exception. What is the best way to execute a PL/SQL block using Toplink?
Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: ORA-00900: invalid SQL statement
Error Code: 900
Call: declare val NUMBER := 1; begin val := 2; end;
Query:DataReadQuery()
at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:290)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:570)
at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:442)
at oracle.toplink.threetier.ServerSession.executeCall(ServerSession.java:453)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:117)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:103)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:174)
at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:156)
at oracle.toplink.queryframework.DataReadQuery.executeNonCursor(DataReadQuery.java:118)
at oracle.toplink.queryframework.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:110)
at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:603)
at oracle.toplink.queryframework.DataReadQuery.execute(DataReadQuery.java:96)
at oracle.toplink.publicinterface.Session.internalExecuteQuery(Session.java:2062)
at oracle.toplink.publicinterface.Session.executeQuery(Session.java:981)
at oracle.toplink.publicinterface.Session.executeQuery(Session.java:938)Could you try the following:
Session s = ...
DataModifyQuery dmq = new DataModifyQuery();
SQLCall sqlCall = new SQLCall();
sqlCall.setQueryString(
"declare\n" +
" val NUMBER := 1;\n" +
"begin\n" +
" val := 2;\n" +
"end;");
sqlCall.setQuery(dmq);
dmq.setCall(sqlCall);
s.executeQuery(dmq);
Maybe you are looking for
-
Assign value to a record in a loop?
I have the record as following: TYPE Curr_Select_Rec IS RECORD ser_date date, blk_route varchar210) p_select Curr_Select_Rec; How do I assign value to it in a loop? I know I can do this p_select.blk_route := 'aaaa'; but in the loop Loop How?????? end
-
How can I solve the error "media corruption error"?
I have asynchronous errors in Media and MediaPlayer objects: [com.sun.media.jfxmediaimpl.NativeMediaPlayer@1b0a038] "Error: medio corrupto": "Error: medio corrupto". When the program runs in NetBeans the error doesn´t appear "quickly". When the progr
-
Computer won't boot, all I get is a black screen
I'm using Vista home premium and everything was working fine up until the other day. My computer froze up and I shut it down to restart. Upon restarting, I was given the option to start windows normally or in safe mode. I selected to start up windows
-
If I have a Macbook Pro MC723LL/A 15" model.
Could I buy this battery to replace the old one? http://store.apple.com/us/product/MA348LL/A/rechargeable-battery-15-inch-macbook -pro Thanks
-
Nettable option in Stock Warehouse
Hi Experts, What exactly does the nettable option do in the Warehouses setup screen? The help screen states only "Select this check box if you want the warehouse to be involved in the MRP process." Thanks Greig