Exec_Sql.Parse Hang
Hi,
I have problem with Sql statement when i try to parse the following statement ..............Why?
V_Sql := ' Select Group_Name '||
' From Nvs_Users_Vs_Groups_Vw '||
' Where RowNum = 1 '||
' And Upper(Usr_Name) = '||Upper(User);
Exec_Sql.Parse (V_Connection_Id,V_Cursor,V_Sql,Exec_sql.V7);
As explained before the exec_sql package is not provided by Oracle Corporation.A gut feeling tells me OP means one the common built-in packages for Oracle Forms Developer (Pages 45). ;)
So for OP: better to post the question in the Forms forum.
Similar Messages
-
I wrote a very simple program unit in my form
v_actual_cursor :=
'SELECT * from dual';
begin
EXEC_SQL.PARSE(cursor_number, v_Actual_cursor,exec_sql.V7);
exception when others
then erm :=sqlerrm;
err :=sqlcode;
insert into xx_temp3 values(erm,err,1);
commit;
end;
This gives me values 306500: non-ORACLE exception, -306500, 1 in the table xx_temp3...
What can be the problem ??
Please let me know
Thanks
PrashThanks
I was missing
cursor_number := Exec_SQL.Open_cursor;
and also had the datatypes mis-matched, I was sending Varchar to a Number.
Thanks a bunch.
Also this sample dynamic_sql form did not open using forms 6i. I luckly had 10g on my system. -
How can i pass input date parameter in where condition in exec_sql.parse
EXEC_SQL.PARSE(source_connid, source_cursor,'SELECT substr(empid,3,6) ,
attdate ,
to_char(intime1,''HH24MI'') ,
nvl(to_char(outtime2,''HH24MI''),nvl(to_char(intime2,''hh24mi''),nvl(to_char(outtime1,''hh24mi''),null))) ,
''G'' ,
null ,
null ,
55
FROM ' || source_table||'
WHERE attdate = '||:control_main.input_dt);
when i gave this input_dt the output is zero.
without this where condition i am getting records.
its urgent,please help me in this.
Edited by: saru on Jan 12, 2009 2:06 AM
Edited by: saru on Jan 12, 2009 2:53 AMI guess you have a problem with your formats...
try this:
[...]WHERE attdate = to_date('''||to_char(:control_main.input_dt,'dd.mm.yyyy')||''', ''dd.mm.yyyy'')[...]regards -
DocumentBuilder.parse() hangs (net access?)
I have trouble getting the following lines of code to work. It works on my dev machine, but not in the live env.
/* Converts String -> XML DOM Document */
StringReader reader = new StringReader(s); // s is a string containg (valid) xml
InputSource src = new InputSource(reader);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document d = db.parse(src);It hangs with the last last line, eventually resulting in this exception (truncated):
java.net.ConnectException: Connection timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:515)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:318)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:792)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:733)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:658)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:981)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source)
at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)Looks to me like it tries to validate against a DTD that is in the document by trying to download it. Well, how do i turn this feature off, or supply a DTD locally in the file system?Try calling DocumentBuilder.setEntityResolver() with a custom EntityResolver which redirects the dtd url to a local file.
-
Hanging jaxp-1.0.1-parser
We have a bug with a hanging jaxp-parser. Unfortunately the bug is not reproducable, but returns sporadically with serious effects.
We have a permanently running java program, that creates separate worker threads. These threads handle ssl-requests. A request has a xml-format and contains a cdata-section with a base64-coded file in that section. First we read the request in a temporary Unix file. Then we parse the file with a SAX-parser (jaxp.jar, jaxp-1.0.1). The parser parses the file and reads the cdata section. The bug is, that after having read a good part of the cdata section, the parser hangs. At least the parser seems to hang. The java program consumes more and more cpu, so that it seems, that the parser is "actively waiting". The first time, we saw this phenomenon was 6 months ago. At that time we switched from JRE1.2 to JRE1.3. The program had run for 3 years with JRE1.2 without any problems. The bug occurs rarely (only once or twice a day with more than 2000 parsed files a day), but the effect is very serious.
Does any one have an idea?
The idea to replace jaxp-1.0.1 by xerces-j-2.7.1 was discarded because the performance is much worse.
Thanks for your ideas.JAXP 1.0 does not support schema validation.
JAXP 1.1 & JAXP 1.2 support schema validation. -
Parsing XML from a session bean
Hi,
I am trying to use a Sax parser for parsing xml received from a back end
legacy system. The code is executed from a Session bean.
Debugging learned me that the parse() method on the parser hangs the
container without any error or exception trace. The code works fine outside
a container.
All help will be highly appreciated.
KurtI found out that the InputStream implementation used parsing source inside
the container is different
then from the one outside (other type of VM of course!). The Weblogic
implementation blocks at the end of
the stream, while the normal SUN JDK 1.3 returns. This is not a bug, the bug
I found is in my proxy that allows
the connection to the backend. This proxy allows HTTP connections, and I
parse the XML received over HTTP.
Regards,
Kurt
"Todd Karakashian" <[email protected]> wrote in message
news:[email protected]..
That's seems odd. Perhaps there is something going on in your document
handler code that triggers a hang in the environment of the server.
When you see the hang, instruct the VM to give you a thread dump (type
control-<break> on Windows, <control>-\ (backslash) on UNIX in the
window in which the server is running; the results are dumped to
stderr). That will show what every thread in the server is doing. If you
email or post the thread dump, I will take a look at it and see if I can
see what is going on. Also, let us know which platform, VM, parser, and
WebLogic version you are using.
Regards,
-Todd
Kurt Quirijnen wrote:
Hi,
I am trying to use a Sax parser for parsing xml received from a back end
legacy system. The code is executed from a Session bean.
Debugging learned me that the parse() method on the parser hangs the
container without any error or exception trace. The code works fine
outside
a container.
All help will be highly appreciated.
Kurt--
Todd Karakashian
BEA Systems, Inc.
[email protected] -
Help required in Exec_Sql Package
Hi,
Plz help me in this program unit
<PRE>
BEGIN -- obtain the default connection and check that it is valid
connection_id := EXEC_SQL.DEFAULT_CONNECTION;
bIsConnected := EXEC_SQL.IS_CONNECTED;
IF bIsConnected = FALSE THEN
P_Alert('No primary connection. Please connect before retrying.');
END IF; --
cursorID := EXEC_SQL.OPEN_CURSOR;
sqlstr := 'select emp_no from Hr_Employee';
EXEC_SQL.PARSE(cursorID, sqlstr, exec_sql.V7);
-- EXEC_SQL.DEFINE_COLUMN(cursorID,1,V_Emp_Id);
nIgn := EXEC_SQL.EXECUTE(cursorID);
LOOP
IF (EXEC_SQL.FETCH_ROWS(cursorID) > 0) and i <= 5 THEN
EXEC_SQL.COLUMN_VALUE(cursorID, 1, V_EMP_ID);
P_ALERT(V_EMP_ID);
ELSE
RAISE FORM_TRIGGER_FAILURE;
END IF;
END LOOP;
EXEC_SQL.CLOSE_CURSOR(cursorID);
EXEC_SQL.CLOSE_CONNECTION;
End </PRE>
The Problem is it is raising the exception. It is not displaying the emp_id.
the other one is with "EXEC_SQL.DEFINE_COLUMN(cursorID,1,V_Emp_Id);
" I'm facing the error too many declaration with this statement.
Thanks in advance.
Regards,
AlokHello,
<p>Have you read this article?. It contains code that queries the EMP table with the EXEC_SQL package.</p>
Francois -
Parsing from InputStream problem
I have a serious problem with parsing XML from an InputStream.
It is the exact same problem other people had before in those threads :
http://forum.java.sun.com/thread.jsp?forum=34&thread=343710
http://forum.java.sun.com/thread.jsp?forum=34&thread=68180
http://forum.java.sun.com/thread.jsp?forum=34&thread=68259
I have read the FAQ at http://www.jdom.org/docs/faq.html which suggest the following :
byte[] buf = new byte[length];
new DataInputStream(inputStream).readFully(buf);
InputStream in = new ByteArrayInputStream(buf);
(Contributed by Joseph Bowbeer)
But my problem still remains the same. What happens if more than 1 XML documents were writen in the InputStream because the writting took place very fast and the receiver could not parse the XML document fast enough so now the byte buffer 'buf' contains 2 XML documents one after the other ? What if it contains half XML document because the sender was temporarily blocked or something; and after some time it continues with the rest XML document ?
how could I overcome those problems ?
thanksThe root cause of the problems reported in this and other threads seems to be the SAX parsers are buffering the entire input stream before they commence parsing (which appears to be completely contrary to the spirit of SAX). This explains the parser hanging behaviour reported by some folk. It also explains why the parsers are awaiting for some sort of EOF marker before they begin parsing.
Maybe this buffering behaviour has been fixed in the newer releases of xerces and crimson et al, but there is a good discussion of this problem and a solution (albeit for xerces), at http://xml.apache.org.xerces-j/faq-write.html, under the section "how do I read data from a stream as it arrives?". -
Exec_sql package is not performing an update....
Hello everybody, i'm working on oracle forms 10g R2, i used the exec_sql built in package, my problem is that the update statement is not performed....
here is the code:
declare
connection_id EXEC_SQL.CONNTYPE;
cursorID EXEC_SQL.CURSTYPE;
sqlstr varchar2(1000):= 'update test_connect_by set parent=10450 where parent=10452';
nRes number;
begin
connection_id := EXEC_SQL.OPEN_CONNECTION('hr/admin@db10g');
cursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr);
nRes := EXEC_SQL.EXECUTE(connection_id,cursorID);
EXEC_SQL.CLOSE_CURSOR(connection_id, cursorID);
EXEC_SQL.CLOSE_CONNECTION(connection_id);
message('row(s) updated '|| to_char(nRes));
end;
the messahe give me rows updated is 0 why????
i check the database there is a record where parent value=10452......
thank you....Your code worked for me. All I changed was the login string, table name and column name. In my test, it reported:
row(s) updated 2 -
Troubles with using twice exec_sql in a procedure
Then I've written a procedure (1), using exec_sql.execute, that executes an SQL string, given the number of columns.
Then, I've written a procedure (2), using exec_sql.describe_column, that identifies the columns in the result of an SQL string.
Both of them work.
So I tried to merge them, so I shouldn't need to know how many columns I have to extract in the procedure (2), but, after executing the "(1)" part, an exception (ORA-306500: non-Oracle exception) is thrown when "res := exec_sql.execute(cursID)" is executed.
Excluding exclusively one of the two parts with /* and */, I see that each part, stand alone from another, works!
I use the same cursor (exec_sql.curstype) for both parts. I've also tried to use two different cursors, closing the former before opening the latter, but the results don't change.
Where is the trouble?
Thanks in advance.Here is the code. Thanks in advance.
procedure push_xls_query(wh text_io.file_type, wh_web varchar2, titolo varchar2, testoquery varchar2) is
type stringArray is table of varchar2(500) index by binary_integer;
type intArray is table of pls_integer index by binary_integer;
valori stringArray;
tipi intArray;
nRows number := 0;
i number := 0;
cursorID exec_sql.curstype;
result pls_integer;
colName varchar2(30);
colLen number;
colType pls_integer;
numerocampi number;
temp1 varchar2(80);
begin
-- Se la lunghezza del titolo e' maggiore di 31 caratteri, lancia una eccezione
if length(titolo) > 31 then
raise xls_exception;
end if;
pkg_txt_io.putline(wh, wh_web, '<Worksheet ss:Name="'||to_xml(titolo)||'"><Table>');
numerocampi := 0;
cursorID := exec_sql.open_cursor;
exec_sql.parse(cursorID, testoquery, exec_sql.V7);
message('Prima di execute'); message(' ', no_acknowledge);
result := exec_sql.execute(cursorID);
message('Dopo di execute'); message(' ', no_acknowledge);
-- Stampa i nomi dei campi
pkg_txt_io.putline(wh, wh_web,'<Row>');
loop
numerocampi:=numerocampi+1;
begin
exec_sql.describe_column(cursorID, numerocampi, colName, colLen, colType);
tipi(numerocampi) := colType;
if colType in (exec_sql.NUMBER_TYPE,
exec_sql.FLOAT_TYPE,
exec_sql.ROWID_TYPE) then
temp1 := 'rightbold';
else
temp1 := 'bold';
end if;
pkg_txt_io.putline(wh, wh_web, '<Cell ss:StyleID="'||temp1||'"><Data ss:Type="String">'||to_xml(colName)||'</Data></Cell>');
exception
when others then
if sqlcode=1 then -- -306500 then
exit;
else
message('Errore imprevisto: '||SQLCODE||' - '||SQLERRM);
message(' ', no_acknowledge);
return;
end if;
end;
end loop;
pkg_txt_io.putline(wh, wh_web,'</Row><Row></Row>');
i := 1;
while i <= numerocampi loop
valori(i) := null;
exec_sql.define_column(cursorID, i, valori(i), 500);
i := i+1;
end loop;
while (exec_sql.fetch_rows(cursorID)>0) loop
nRows := nRows + 1;
pkg_txt_io.putline(wh, wh_web, '<Row>');
i := 1;
while i <= numerocampi loop
exec_sql.column_value(cursorID, i, valori(i));
if tipi(i) in (exec_sql.NUMBER_TYPE,
exec_sql.FLOAT_TYPE,
exec_sql.ROWID_TYPE) then
temp1 := 'Number';
else
temp1 := 'String';
end if;
pkg_txt_io.putline(wh, wh_web, '<Cell><Data ss:Type="'||temp1||'">'||to_xml(valori(i))||'</Data></Cell>');
i := i+1;
end loop;
pkg_txt_io.putline(wh, wh_web, '</Row>');
end loop;
exec_sql.close_cursor(cursorID);
pkg_txt_io.putline(wh, wh_web, '</Table></Worksheet>');
end;
procedure push_xls_simplequery(filename varchar2, testoquery varchar2) is
wh text_io.file_type;
wh_web varchar2(1);
begin
begin
pkg_txt_io.delete_temp_file(filename);
exception
when pkg_txt_io.ex_web_io then null;
end;
pkg_txt_io.open(filename, 'w', wh, wh_web);
push_xls_begin(wh, wh_web);
push_xls_query(wh, wh_web, 'Sheet1', testoquery);
push_xls_end(wh, wh_web);
pkg_txt_io.close(wh, wh_web);
end; -
EXEC_SQL Package With Ora-306500 error
I write this pl/sql and the Ora-306500 and i dont know where is the error
declare
con1 exec_sql.conntype;
cur1 exec_sql.curstype;
nign2 PLS_INTEGER;
begin
con1:= exec_sql.open_connection('user1/pass@server');
cur1:= exec_sql.open_cursor(haj3_con con1);
exec_sql.parse(con1,cur1,'begin create table user1.x as select * from user2.y; end;' , exec_sql.v7);
-- and i try this also
--exec_sql.parse(con1,cur1,'create table user1.x as
--select * from user2.y' , exec_sql.v7);
nign2 := exec_sql.EXECUTE(con1,cur1);
exec_sql.close_cursor(con1,cur1);
exec_sql.close_connection(con1);
end;
so plz anybody can help me??Hi,
write and exception-handler where you capture the EXEC_SQL.Package_Error exception and then show the last error raised by the exec_sql package.
eg.
BEGIN
EXCEPTION
WHEN EXEC_SQL.Package_Error THEN
MESSAGE('Code: ' || EXEC_SQL.Last_Error_Code || ' Msg: ' || EXEC_SQL.Last_Error_Mesg || ' Position: ' || EXEC_SQL.Last_Error_Position );
END;
Patrick -
Exec Stored Function in EXEC_SQL?
Hi!
How to execute a function in EXEC_SQL? I need a sample. Thanks!
SteeniePlease follow the following Example to implement EXEC_SQL.
PROCEDURE Test IS
connection_id EXEC_SQL.CONNTYPE;
cursorID EXEC_SQL.CURSTYPE;
sql_string VARCHAR2(1000);
lv_ename VARCHAR2(30);
lv_eno NUMBER;
lv_hiredate DATE;
exec_id PLS_INTEGER;
BEGIN
connection_id := EXEC_SQL.OPEN_CONNECTION(connect_str);
cursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
sql_string := 'select ename, empno, hiredate from emp ';
EXEC_SQL.PARSE(connection_id, cursorID, sql_string, exec_sql.V7);
EXEC_SQL.BIND_VARIABLE(connection_id, cursorID, ':bn', input_empno);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 1, lv_ename, 30);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 2, lv_eno);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 3, lv_hiredate);
-- after parsing, and calling BIND_VARIABLE and DEFINE_COLUMN, if necessary, you are ready to execute the statement. Note that all information
-- about the statement and its result set is encapsulated in the cursor referenced as cursorID.
exec_id := EXEC_SQL.EXECUTE(connection_id, cursorID);
END;
If you still get error after following the above example please send me your code to [email protected] -
EXEC_SQL connection error
Hi,
I'm trying to use EXEC_SQL to connect to a remote database to copy an image(BLOB) to my form.
I've tested the code using dbms_sql access non-BLOB columns from the remote database then adapted those lines to EXEC_SQL to use from a different database BEFORE adding the access to a BLOB and getting error ... ORA 306500
Error trapping using messages shows the connection line is the issue, so guessing my connection isn't working. As you can see below I've used string scott/tiger@remote_db but if my actual connection isn't working, is there a way I can test it and get a better message?
I'm migrating from v6 to 10g forms and testing it in both.
Thanks for your time :-)
Elaine
==========Form Program Unit =====================
PROCEDURE GET_DATAHUB_INFO_EXEC IS
connection_id EXEC_SQL.CONNTYPE;
cursorID EXEC_SQL.CURSTYPE;
connect_str VARCHAR2(100);
-- cursorID INTEGER;
sqlstr VARCHAR2(1000);
new_perid NUMBER;
new_image BLOB;
block_perid varchar2(10);
nIgn PLS_INTEGER;
BEGIN
block_perid:=to_char(:images.person_id);
connect_str:='scott/tiger@remote_db';
-- a connection string is typically of the form 'username/password@database_alias'
MESSAGE('before connect');
connection_id := EXEC_SQL.OPEN_CONNECTION('connect_str');
MESSAGE('before Open');
cursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
-- cursorID := DBMS_SQL.OPEN_CURSOR;
-- sqlstr := 'SELECT new.person_id, new.image FROM IBANK.IMAGES@remote_db new
sqlstr := 'SELECT new.person_id FROM IBANK.IMAGES new
WHERE new.person_id=to_number(:curr_perid)';
-- DBMS_SQL.PARSE(cursorID, sqlstr,0);
-- DBMS_SQL.BIND_VARIABLE(cursorID, ':curr_perid', block_perid);
-- DBMS_SQL.DEFINE_COLUMN(cursorID, 1, new_perid);
-- DBMS_SQL.DEFINE_COLUMN(cursorID, 2, new_image);
MESSAGE('After opne');
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
EXEC_SQL.BIND_VARIABLE(connection_id, cursorID, ':curr_perid', block_perid);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 1, new_perid);
MESSAGE('After Define');
-- EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 2, new_image);
-- after parsing, and calling BIND_VARIABLE and DEFINE_COLUMN, if necessary, you
-- are ready to execute the statement. Note that all information about the
-- statement and its result set is encapsulated in the cursor referenced as cursorID.
nIgn := EXEC_SQL.EXECUTE(connection_id, cursorID);
-- nIgn := DBMS_SQL.EXECUTE(cursorID);
LOOP
--Fetch rows
IF EXEC_SQL.FETCH_ROWS(connection_id, CursorId)=0 THEN
-- IF DBMS_SQL.FETCH_ROWS(CursorId)=0 THEN
EXIT;
END IF;
-- retrieve into variables
EXEC_SQL.COLUMN_VALUE(connection_id, CursorId,1,new_perid);
-- EXEC_SQL.COLUMN_VALUE(connection_id, CursorId,2,new_image);
-- DBMS_SQL.COLUMN_VALUE(CursorId,1,new_perid);
-- DBMS_SQL.COLUMN_VALUE(CursorId,2,new_image);
:images.nbt_curr_person_id:=new_perid;
END LOOP;
EXEC_SQL.CLOSE_CURSOR(cursorID);
-- DBMS_SQL.CLOSE_CURSOR(cursorID);
EXCEPTION
WHEN EXEC_SQL.Package_Error THEN
-- code obtained from another discussion thread that doesn't work
MESSAGE('Code: ' || EXEC_SQL.Last_Error_Code ||
' Msg: ' || EXEC_SQL.Last_Error_Mesg ||
' Position: ' || EXEC_SQL.Last_Error_Position );
RAISE;
WHEN OTHERS THEN
-- close the cursor and raise error again
EXEC_SQL.CLOSE_CURSOR(cursorID);
-- DBMS_SQL.CLOSE_CURSOR(cursorID);
RAISE;
END;
==========================Still not had an answer to this problem. So let's recap
1) I'm trying to test accessing data from a different DB (my_newDB) in forms by using EXEC_SQL and creating a new connection for the data.
[I eventually need to access an image as a BLOB so can't use a simple DB link but am testing without for the moment]
2) I have condensed the code used and included it below. If I don't have an Exception section I get error:
FRM-40735: Key-nxtrec trigger raised unhandled exception ORA-306500
3) If I add the exception section :
EXCEPTION WHEN EXEC_SQL.Package_Error THEN
Declare vSQLcode number := SQLcode;
vSQLerrm Varchar2(200) := SQLerrm;
Begin
If vSQLcode = -306500 then -- Exec_SQL.package_error
vSQLcode := -abs(Exec_SQL.Last_Error_Code);
vSQLerrm := Exec_SQL.Last_Error_Mesg;
End if;
Message('Except: ' || vSQLerrm );
Message(' ',no_acknowledge);
End;
I then get
Except: ORA-00000: normal, successful completion
Note this fires at open_connection line and then no more of Program unit runs
You can see my debug messages, so I know where it is.
-------------------- condensed Program Unit - Fires on KEY-NXTREC and KEY-DOWN
PROCEDURE GET_DATABASE_INFO IS
bIsConnected BOOLEAN ;
connection_id EXEC_SQL.CONNTYPE; -- holds the connection
cursorID EXEC_SQL.CURSTYPE;
connect_str VARCHAR2(100);
sqlstr VARCHAR2(1000);
new_perid NUMBER;
block_perid varchar2(10);
nIgn PLS_INTEGER;
BEGIN
block_perid:=to_char(:b_images.person_id);
connect_str:='scott/tiger@my_newdb';
MESSAGE('before connect');
connection_id := EXEC_SQL.OPEN_CONNECTION('connect_str');
MESSAGE('before Open');
cursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
sqlstr := 'SELECT new.person_id FROM IBANK.IMAGES@my_newdb new
WHERE new.person_id=to_number(:curr_perid)';
MESSAGE('After open');
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
EXEC_SQL.BIND_VARIABLE(connection_id, cursorID, ':curr_perid', block_perid);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 1, new_perid);
MESSAGE('After Define');
nIgn := EXEC_SQL.EXECUTE(connection_id, cursorID);
LOOP
--Fetch rows
IF EXEC_SQL.FETCH_ROWS(connection_id, CursorId)=0 THEN
EXIT;
END IF;
-- retrieve into variables
EXEC_SQL.COLUMN_VALUE(connection_id, CursorId,1,new_perid);
Message('new_perid='||new_perid);
:b0.nbt_curr_person_id:=new_perid;
END LOOP;
EXEC_SQL.CLOSE_CURSOR(connection_id, cursorID);
exec_sql.close_connection(connection_id);
END; -
Migrate to 5.0 to 6i and the exec_sql stop working
Hi,
I4ve migrate my application from Forms 5.0... to 6i(6.0.8.17.1). I have a function that uses EXEC_SQL, and this funcionallity stops working. When I execute the following commands I have an ORA-306500 error.
-- Open the cursor
cursor_count := exec_sql.open_cursor(p_conexao);
-- Command to be executed
exec_sql.parse(p_conexao, cursor_count,'select count(*) from ' || p_dctabela || dcwhere);
-- Defining columns
exec_sql.define_column(p_conexao, cursor_count, 1, lcounttabela);
-- Executing
ignore := exec_sql.execute(p_conexao, cursor_count);
At this point I4ve got the ORA-306500 error.
I4ve installed :
- Oracle Open Client Adapter for ODBC 2.0.2.15.0
-- Oracle Open Client Adapter Deployment Components 2.0.2.15.0
-- Oracle Open Client Adapter Development Components 2.0.2.15.0
-- Oracle Open Client Adapter Language Supplement 2.0.2.15.0
- Oracle Open Client Adapter for ODBC 6.0.5.35.0
-- Oracle Open Client Adapter Deployment Components 6.0.5.35.0
-- Oracle Open Client Adapter Language Supplement 6.0.5.29.0
The ODBC is correctly configured, the source is DBF.
Thanks in advance,
JorgeI have the same problem!
Let me know if you find any solution.
/Tobias Lindblom
[email protected] -
How to fetch rows using exec_sql
hello to all
i want to open a cursor and fetch some field values dynamically."the fields to be fetched will be selected by the user" i.e i have to get the data of the fields selected by the user.
for this i am using the exec_sql method.
its giving a message as 'FRM-01747: invalid user.table.column,table.column or column specification"
i don't where i am wrong in the code.
this is my code to fetch the values
Declare
Con_id EXEC_SQL.CONNTYPE;
Cur_id EXEC_SQL.CURSTYPE;
sqlstr varchar2(3000);
fld1 number(20,2);
fld2 number(20,2);
fld3 number(20,2);
fld4 number(20,2);
fld5 number(20,2);
fld6 number(20,2);
fld7 number(20,2);
fld8 number(20,2);
nEmpno number(10,4);
nIgn PLS_INTEGER;
totRows number(5);
a number;
Begin
--1
Con_id := EXEC_SQL.DEFAULT_CONNECTION;--('scott/tiger@siil');
go_block('BlkDet');
Cur_id := EXEC_SQL.OPEN_CURSOR();
sqlstr := 'Select A.EmpNo,A.'||:BlkMain.LstFld1||',A.';
sqlstr := sqlstr||:BlkMain.LstFld2||',A.';
sqlstr := sqlstr||:BlkMain.LstFld3||',A.';
sqlstr := sqlstr||:BlkMain.LstFld4||',B.';
sqlstr := sqlstr||:BlkMain.LstFld1||',B.';
sqlstr := sqlstr||:BlkMain.LstFld2||',B.';
sqlstr := sqlstr||:BlkMain.LstFld3||',B.';
sqlstr := sqlstr||:BlkMain.LstFld4;
sqlstr := sqlstr||' from Tempsalmast A, SalMast B';
sqlstr := SqlStr||' where A.EmpNo=B.EmpNo';
Message(SqlStr);
Message(SqlStr);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,1,nEmpNo);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,2,Fld1);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,3,Fld2);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,4,Fld3);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,5,Fld4);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,6,Fld5);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,7,Fld6);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,8,Fld7);
EXEC_SQL.DEFINE_COLUMN(Con_id,Cur_id,9,Fld8);
EXEC_SQL.PARSE(Con_id,Cur_id,sqlstr,EXEC_SQL.V7);
nIgn:=EXEC_SQL.EXECUTE(Con_id,Cur_id);
while (EXEC_SQL.FETCH_ROWS(Con_id,Cur_id)>0) Loop
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,1,nEmpNo);
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,2,Fld1);
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,3,Fld2);
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,4,Fld3);
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,5,Fld4);
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,6,Fld5);
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,7,Fld6);
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,8,Fld7);
EXEC_SQL.COLUMN_VALUE(Con_id,Cur_id,9,Fld8);
:BlkDet.TxtEmpNo:=nEmpNo;
:BlkDet.DisFld1 :=Fld1;
:BlkDet.DisFld2 :=Fld2;
:BlkDet.DisFld3 :=Fld3;
:BlkDet.DisFld4 :=Fld4;
:BlkDet.TxtFld1 :=Fld5;
:BlkDet.TxtFld2 :=Fld6;
:BlkDet.TxtFld3 :=Fld7;
:BlkDet.TxtFld4 :=Fld8;
next_record;
end Loop;
--next_record;
end;
exception
when others then
Message(Dbms_Error_Text);
Message(Dbms_Error_Text);
can any body pls. help me out
adityaFetching rows to display them is a task for the client tool. You need to define a ref cursor therefore.
If you just want to play around, here we go
SQL> DECLARE
2 type t1 is table of emp%rowtype index by binary_integer;
3 var1 t1;
4 v_counter number:=0;
5 BEGIN
6 select * bulk collect into var1 from emp;
7 for vr in 1..var1.count loop
8 dbms_output.put_line(var1(vr).ename);
9 update dept set deptno=var1.deptno Here also Error occured.
10 end loop;
11 END;
12 /
SCOTT
ADAMS
PL/SQL procedure successfully completed.
SQL>
Maybe you are looking for
-
Hi All, I installed Hyperion 11.1.2.2 in two servers named as machine1 and machine2. In machine1, i installed Sql server, Essbase and FDM In machine2, i installed Foundation services, HFM, Planning, Workspace and Reporting analysis. First i Sql serve
-
Do I have to upgrade to view my RAW files from my Nikon d610?
I just recently purchased the D610 and my version of Lightroom (4) will not recognize the RAW files. Is there a way so that I can work straight from Lightroom vs opening everything in Photoshop, then saving my images as TIFF? Or must I upgrade to ver
-
REmoving App from System Preferences
I have an app in the system preferences in the 'other' section. I do not want it anymore and therefore I would like to remove from the preferences. Where do I go to have it removed. Thx.
-
How to List the Root Path?
Hi all, How can I list the root path? (windows: "My Computer", UNIX: / ) I tried File f = new File("/"); String s = f.list(); It didn't work.... Thanks for your help.
-
Hello, how do I efficiently implement form-based authentication for a JSP/SERVLET app using existing users database in oracle. I use a servlet to authenticate users against the database and set session value. On every subsequent request I check for t