Ora-306500
Declare
Connection_id EXEC_SQL.CONNTYPE;
CursorID EXEC_SQL.CURSTYPE;
SqlStr VARCHAR2(1000);
Loc_EName VARCHAR2(30);
Loc_Eno NUMBER;
Loc_Hiredate DATE;
NIgn PLS_INTEGER;
Begin
Connection_id := EXEC_SQL.OPEN_CONNECTION('PAL_SECURITY','PAL_SECURITY','DPC');
CursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
Sqlstr := 'CREATE USER '||:BLK_NVS_USERS_ALL.USR_NAME||' IDENTIFIED BY '||:BLK_NVS_USERS_ALL.PASSWORD;
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
NIgn := EXEC_SQL.EXECUTE(connection_id, cursorID);
Sqlstr := 'GRANT CONNECT TO '||:BLK_NVS_USERS_ALL.USR_NAME;
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
NIgn := EXEC_SQL.EXECUTE(connection_id, cursorID);
End;
Hi all ,
I am getting this error when i try to execute the above statments.
Ora-306500
Edited by: kingadmin on May 2, 2010 10:17 AM
King i checked your coding there is no connection problem actually error is generating to the following line,
Sqlstr := 'CREATE USER '||'sajid'||' IDENTIFIED BY '||'123';
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
so when i rem two lines and just define grant to existing user that running successfully, but i am still checking your code probably it will resolve.
Declare
Connection_id EXEC_SQL.CONNTYPE;
CursorID EXEC_SQL.CURSTYPE;
SqlStr VARCHAR2(2000);
Loc_EName VARCHAR2(30);
Loc_Eno NUMBER;
Loc_Hiredate DATE;
NIgn PLS_INTEGER;
Begin
--Connection_id := EXEC_SQL.OPEN_CONNECTION('SYSTEM','ORACLE','SYSDBA');
Connection_id := EXEC_SQL.OPEN_CONNECTION('SYSTEM','ORACLE','orcl');
--Connection_id := EXEC_SQL.OPEN_CONNECTION('SYSTEM/ORACLE@ORCL');
CursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
Sqlstr := 'CREATE USER '||'sajid'||' IDENTIFIED BY '||'123';
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
NIgn := EXEC_SQL.EXECUTE(connection_id, cursorID);
Sqlstr := 'GRANT CONNECT TO '||:BLK_NVS_USERS_ALL.USR_NAME;
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
NIgn := EXEC_SQL.EXECUTE(connection_id, cursorID);
End;
Similar Messages
-
ORA-306500 error when using EXEC_SQL? [SOLVED]
I used Francois Degrelle's example of doing a dynamic where clause to create a procedure using the EXEC_SQL package to get various counts from a table with different where clauses. Everything works for all the where clauses except when I try a date comparison I get the ORA-306500 error. The where clause I'm using takes 2 screen date fields:
'WHERE date_column BETWEEN ' || :date_field1 || ' AND ' || :date_field2
Anybody know what is causing this error?you forgot the to_date in the dynamic part.
what you pass to sql engine now is
where date_column between 10-FEB-2008 and 11-FEB-2008
don't think this would work...
what you need is:
where date_column between to_date('10-FEB-2008', 'DD-MON-RRRR') and .....
so you have to do some type conversions:
first of all convert in your form your date variable to a string with known format:
=> to_char(:date_field, 'DD-MON-RRRR')
now you have a string which looks like this:
'10-FEB-2008'
then let's go over to the dynamic part:
you want to restrict your where clause on date values, so when restricting with specific strings (the string from above), you have to convert it to a date datatype with to date.
so, this would look like this (as mentioned in my last post):
'.....between to_date(''''||to_char(:date_field1, 'dd-mon-rrrr')||''', ''dd-mon-rrrr'') and ..... '
best thing would be to display your query, and pass it in sqlplus as long it won't work ;-).
regards -
Frm-40375 and ora-306500 with ODBC connection
Hi experts,
I am getting frm-40375 , ora-306500 when clicking a button on form , the code behind the button is actually connecting to a database other than oracle using the ODBC connection and importing data in variables and than inserting in an oracle table.
The error only appears on other PCs and not on my pc , means there is no problem in the code and is working fine on my pc (importing the desired data when using my pc).
The question is what is missing on other PCs or in other words what is additional component in my PC.
Please tell when and why this ora-306500 occurs.
Hope I defined the problem correctly.
(the following is part of the code
connection_string:='user/pass123@ODBC:abcd123';
connection_id := EXEC_SQL.OPEN_CONNECTION(connection_string);
cursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
Using Oracle 9i Database
and 6i Forms
Thanks in advance
Edited by: zulfffi on Jun 29, 2010 11:08 PMora-306500I seriously doubt this is actual error code.
AFAIK - Oracle errors have not yet reached 6 decimal places.
please use COPY & PASTE in the future -
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 -
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; -
How to connect Forms 6i with MS Access
Dear All:
Can we connect Forms 6i with MS Access? If yes then how? Any document? Any suggestions?
Thanks
HassanThanks Jose for your suggestions:
I am sorry I did not use the search utility of Forum.
Anyway I have connect the Forms 6i with MS Access
I created two text item in a Non-Database block and write following coding on a Push Button:
declare
connection_id EXEC_SQL.CONNTYPE;
cursorID EXEC_SQL.CURSTYPE;
sqlstr VARCHAR2(1000);
d1 VARCHAR2(100);
d2 NUMBER;
nIgn PLS_INTEGER;
nRows PLS_INTEGER := 0;
BEGIN
connection_id := EXEC_SQL.OPEN_CONNECTION('hsn','hsn','odbc:test');
cursorID := EXEC_SQL.OPEN_CURSOR(connection_id);
sqlstr := 'select d1,d2 from abdali ';
EXEC_SQL.PARSE(connection_id, cursorID, sqlstr, exec_sql.V7);
EXEC_SQL.BIND_VARIABLE(connection_id, cursorID, '', '');
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 1, d1, 100);
EXEC_SQL.DEFINE_COLUMN(connection_id, cursorID, 2, d2, 100);
nIgn := EXEC_SQL.EXECUTE(connection_id, cursorID);
WHILE (EXEC_SQL.FETCH_ROWS(connection_id, cursorID) > 0 ) LOOP
nRows := nRows + 1;
EXEC_SQL.COLUMN_VALUE(connection_id, cursorID, 1, :d1);
--EXEC_SQL.COLUMN_VALUE(connection_id, cursorID, 2, :d2);
next_record;
END LOOP;
message(nrows);
IF (nRows <= 0) THEN
TEXT_IO.PUT_LINE ('Warning: query returned no rows');
END IF;
END;
I can retrieve the data from MS Access but there is a problem occured.
The data type of one column in Access is defined as Intiger
I also defined a text item in form as Intiger but when retrieved then it returned following error:
FRM-40735: WHEN-BUTTON-PRESSED trigger raised unhandled exception ORA-306500.
I remarked the following coding it works fine.
EXEC_SQL.COLUMN_VALUE(connection_id, cursorID, 2, :d2);
Any suggestions: I also read the OCA_INFO.pdf but did not find how to handle this type of problem.
If you can help me to find out how to match the data types of both the databases?
Also can I insert the data from a Database Block of Oracle into MS-ACCESS thru write code on the Button.
Thanks for help
Hassan -
How to use form connect to MS SqlServer?
Hi,
I want to use form9i connect to MS Sqlserver.
I try to use this to test connect.
=========================================
declare
connection_id EXEC_SQL.ConnType;
cursor_number EXEC_SQL.CursType;
-- Variables for the data to be returned into
begin
connection_id := EXEC_SQL.OPEN_CONNECTION('sa/pwd@odbc:sqlserver1');
if EXEC_SQL.IS_CONNECTED(connection_id) then
message('Connected to sqlserver');
else
message('ERROR: No connection established');
end if;
end;
=====================
But It's not work.
It's show message 'Frm-40735 and ora-306500.'
Please help me .
Thank you.Hi,
Forms 9i doesn't support ODBC. You would need a transparent Gateway to connect to non Oracle databases
Frank -
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] -
PL/SQL report errors: ORA-01422
Hi all,
(before i you read i would like to say i have searched the net for this error code but nothing shows up like this problem..)
I am getting an error problem when i select certain Schemas from a list on an apex app. page, it only works for some schemas not all..
When i select one schema, it is supposed to display one row.. when i select [ALL] it is supposed to show them all.
It does work if i select '[ALL]' from the select list (p3_schema_name), just not for every single individual one.
the error code:
ORA-01422: exact fetch returns more than requested number of rows
declare
vSchema varchar2(20);
vStmt varchar2(1000);
vVersion number(5);
vDBName varchar2(20);
vHostName varchar2(80);
vStmt2 varchar2(1000);
vVersion2 number(5);
vDBName2 varchar2(20);
vServer2 varchar2(80);
vSchema2 varchar2(80);
CURSOR c_schemas IS
select owner from dba_tables@P3_DB_NAME.db_link where table_name = 'DDL_LOG' and num_rows > 0 order by owner;
begin
IF :P3_SCHEMA_NAME != '[ALL]' AND :P3_DB_NAME IS NOT NULL AND :P3_SERVER_NAME IS NOT NULL THEN
vServer2 := :P3_SERVER_NAME;
vSchema2 := :P3_SCHEMA_NAME;
vStmt2 := 'select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from &P3_SCHEMA_NAME..ddl_log@&P3_DB_NAME.db_link GROUP BY DDH_DB_NM';
Execute Immediate vStmt2 into vDBName2, vVersion2;
htp.p('<br>');
htp.p('<table border="1">');
htp.p('<tr>');
htp.p('<th bgcolor="#FFCC99">SERVER NAME</th>');
htp.p('<th bgcolor="#FFCC99">DB NAME</th>');
htp.p('<th bgcolor="#FFCC99">SCHEMA NAME</th>');
htp.p('<th bgcolor="#FFCC99">PATCH</th>');
htp.p('</tr>');
htp.p('<tr>');
htp.p('<td>');
htp.p(vServer2);
htp.p('</td>');
htp.p('<td>');
htp.p(vDBName2);
htp.p('</td>');
htp.p('<td>');
htp.p(vSchema2);
htp.p('</td>');
htp.p('<td>');
htp.p(vVersion2);
htp.p('</td>');
htp.p('<td>');
htp.p('<BR>');
htp.p('</td>');
htp.p('</tr>');
htp.p('</tr>');
htp.p('</table>');
ELSE IF :P3_SCHEMA_NAME = '[ALL]' AND :P3_DB_NAME IS NOT NULL AND :P3_SERVER_NAME IS NOT NULL THEN
vHostName := :P3_SERVER_NAME;
vDBName := :P3_DB_NAME;
open c_schemas;
htp.p('<br>');
htp.p('<table border="1">');
htp.p('<tr>');
htp.p('<th bgcolor="#FFCC99">SERVER NAME</th>');
htp.p('<th bgcolor="#FFCC99">DB NAME</th>');
htp.p('<th bgcolor="#FFCC99">SCHEMA NAME</th>');
htp.p('<th bgcolor="#FFCC99">PATCH</th>');
htp.p('</tr>');
LOOP
FETCH c_schemas INTO vSchema;
EXIT WHEN c_schemas%NOTFOUND;
vStmt := 'select max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from '||vSchema||'.ddl_log@&P3_DB_NAME.db_link where DDH_SCHEMA_NR = (select max(DDH_SCHEMA_NR) from '||vSchema||'.ddl_log@&P3_DB_NAME.db_link) and rownum < 2' ;
Execute Immediate vStmt into vVersion ;
htp.p('<tr>');
htp.p('<td>');
htp.p(vHostName);
htp.p('</td>');
htp.p('<td>');
htp.p(vDBName);
htp.p('</td>');
htp.p('<td>');
htp.p(vSchema);
htp.p('</td>');
htp.p('<td>');
htp.p(vVersion);
htp.p('</td>');
htp.p('<td>');
htp.p('<BR>');
htp.p('</td>');
htp.p('</tr>');
END LOOP;
htp.p('</tr>');
htp.p('</table>');
CLOSE c_schemas;
END IF;
END IF;
END;I have checked the DDH_SCHEMA_NR for repeating entries of the highest number.. some of the ones that dont work do have repeating entries some don't.
Sorry if this is confusing, i have tried to explain it as best as i can.
Thanks in advance for any help.
AshleighHello Ashleigh,
Based on your code, I'd start by running this piece of SQL via command-line (thru SQL Workshop, SQL*Plus, Toad, etc.), replacing &P3_SCHEMA_NAME. and &P3_DB_NAME. with values that are currently causing the routine to fail and see if it returns more than one row. I don't know your data, but DISTINCT and GROUP BY are typically used to return multiple (though grouped/summarized) rows. It appears to be the only statement that would cause the error your seeing (more than one row being returned into single variables).
select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from &P3_SCHEMA_NAME..ddl_log@&P3_DB_NAME.db_link GROUP BY DDH_DB_NM;I'm actually surprised that the code runs at all. I didn't think 'execute immediate' would know what to do with substitutions indicated as "&something." (I've typically seen that when substituting in dynamic HTML/Javascript code but maybe I'm learning something new). But since you already have vServer2 and vSchema2, I'd be more apt to code it as:
vStmt2 := 'select distinct DDH_DB_NM, max(DDH_SCHEMA_NR)keep(dense_rank last order by ddh_runstart_td) AS "PATCH" from ' ||
vSchema2 || '.ddl_log@' || vServer2 || '.db_link GROUP BY DDH_DB_NM';Hope this helps,
John -
Ora-00604 error and ora 01000 error while report generation.
hi all,
I am trying to generate the multiple reports of same template through a program.
While this job is running, i get the following error at the BIP console and the reports don't get generated.
[101711_044115578][][EXCEPTION] java.sql.SQLException: ORA-00604: error occurred
at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-00604: error occurred at recursive SQL level 1
ORA-01000: maximum open cursors exceeded
ORA-01000: maximum open cursors exceeded
Kindly help.
Thanks.Lots of resources with a simple search to see what this is about, for example:
http://www.orafaq.com/wiki/ORA-01000
ORA-01000: maximum open cursors exceeded
Cause: A host language program attempted to open too many cursors. The initialization parameter OPEN_CURSORS determines the maximum number of cursors per user.
Action: Modify the program to use fewer cursors. If this error occurs often, shut down Oracle, increase the value of OPEN_CURSORS, and then restart Oracle.
open_cursors parameter
http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/initparams160.htm#REFRN10137
Oracle support note:
OERR: ORA-1000 maximum open cursors exceeded (Doc ID 18591.1) -
EA2: ORA-01427 clicking on a view in the navigator
SQLDev: 1.5.0.52.03
Java: 1.6.0_04
Oracle: 9.2.0.7.0
I'm getting the following error when I click on a view in the navigator pane:
An error was encountered performing the requested operation:
ORA-01427: single-row subquery returns more than one row 01427. 00000 - "single-row subquery returns more than one row"I'm not seeing any errors in the shell window.
After clicking on <OK> in the error dialog, the normal tabs (Columns, Data, Grants, Dependencies, Details, SQL) are displayed, but there is no content in the Columns tab.
All the other tabs seem to function normally.
Here is the DDL from the SQL tab
CREATE OR REPLACE VIEW "SUBSCRIPTIONS"
"ORDER_ID", "SUNBURST_ORDER_ID", "SIEBEL_ORDER_ID", "ACCOUNT_ID",
"COMP_ID", "SUBACCOUNT_ID", "START_DATE", "END_DATE", "PULL_DATE",
"SUBSCRIPTION_TYPE", "PRICE_CLASS", "DESCRIPTION", "SEAT_COUNT",
"ORDER_DURATION", "CALLBACK_INTERVAL", "UPDATE_DATE", "UPDATE_USERNAME",
"AFFILIATE"
AS
SELECT order_id,
sunburst_order_id,
siebel_order_id,
account_id,
comp_id,
subaccount_id,
start_date,
end_date,
pull_date,
product_id,
price_class,
product_name,
add_users,
order_duration,
callback_interval,
last_mdfy_date,
last_mdfy_emp,
affiliate
FROM csbcrossworlds.subscriptions;We have 15 views in this schema, 3 of them fail this way but the other 12 display the columns just fine. So far I am unable to detect any commonality.
Any ideas?Ok, I think I found the problem. The view in question (SUBSCRIPTIONS) is owned by 'PHILC' and it references a table named 'SUBSCRIPTIONS' owned by 'CSBCROSSWORLDS'. There are two other development schemas that also own tables named 'SUBSCRIPTIONS'.
I believe the 'Columns' tab is executing the query below. The subquery in this SQL tries to identify the primary key columns for the 'SUBSCRIPTIONS' view in my schema (PHILC):
SELECT
c.column_name,
DECODE(
data_type,
'CHAR', data_type||'('||c.data_length||')',
'VARCHAR', data_type||'('||c.data_length||')',
'VARCHAR2', data_type||'('||c.data_length||')',
'NCHAR' , data_type||'('||c.data_length||')',
'NUMBER' , DECODE(c.data_precision,null,'NUMBER', data_type||'('||c.data_precision||','||c.data_SCALE||')'),
'NVARCHAR', data_type||'('||c.data_length||')',
'NVARCHAR2', data_type||'('||c.data_length||')',
data_type) data_type,
DECODE(nullable, 'Y', 'Yes', 'No') nullable,
c.DATA_DEFAULT,
column_id,
com.comments,
(SELECT 1 FROM all_constraints, all_cons_columns
WHERE all_constraints.constraint_type = 'P' AND
all_constraints.constraint_name = all_cons_columns.constraint_name AND
all_constraints.owner = all_cons_columns.owner AND
all_cons_columns.table_name = c.table_name AND
c.column_name = all_cons_columns.column_name) Primary_Key,
c_update.insertable,
c_update.updatable,
c_update.deletable
FROM
sys.all_tab_Columns c, sys.all_col_comments com, sys.user_updatable_columns c_update
WHERE
c.owner = :OBJECT_OWNER AND
c.table_name = :OBJECT_NAME AND
c.table_name = com.table_name AND
c.owner = com.owner AND
c.column_name = com.column_name AND
c_update.column_name = com.column_name AND
c_update.table_name = com.table_name
;Extracting the subquery into this:
SELECT
all_constraints.owner,
all_constraints.table_name,
all_constraints.constraint_name
FROM all_constraints, all_cons_columns
WHERE
all_constraints.constraint_type = 'P' AND
all_constraints.constraint_name = all_cons_columns.constraint_name AND
all_constraints.owner = all_cons_columns.owner and
all_cons_columns.table_name = 'SUBSCRIPTIONS' and
'ORDER_ID' = all_cons_columns.column_name;I got this output:
owner table_name constraint_name
CUTOVER SUBSCRIPTIONS SUBSCRIPTIONS_PK
CROSSWORLDS SUBSCRIPTIONS SUBSCRIPTIONS_PK
CSBCROSSWORLDS SUBSCRIPTIONS SUBSCRIPTIONS_PKLooking at the DDL for the view, the row we really want is for owner 'CSBCROSSWORLDS'. Unfortunately, that means having to somehow parse the SQL text to extract the owner name...
Phil -
Using database-link in view to get around ORA-01031 error
I have been granted select rights on a users table. I am therefore able to select from his table. If however I try create a view against his table I run into the ORA-01031 problem. I have worked around this problem by creating a database-link to myself and then adding that to the view creation and it works. What are the downsides of using the database-link in this way?
The only down side I have been able to identify is that a extra session is created and that the CPU has a little extra work due to the LOOP BACK that takes place. I need to ensure the network is not unnessesarly used and therefore will need to ensure that 127.0.0.1 (local host) is used in the database connection discription. e.g.
create database link my_db_link connect to scott identified by tiger using '(description=(address=(protocol=tcp)(host=127.0.0.1) (Port = 1521) ) (connect_data= (sid=ora10g)))'; -
Getting ora:00904 invalid indentifier error while running i query
Hi,
I have a remote database and local database both are oracle 10gR2.Now i have written the below mentioned query in my local database and is working fine,but in case remote database it is throughing error ora:00904 invalid indentifier.
I had export the dump from remote db and import it on my local db and i tried the same and it is working fine on local after that also.
As i believe that this error usually come for column name not exist or column name or it's length or for any special character in column name of the table.But as i said it is working fine on local db but not in remote db though i am using the same dump for local and remote.
Though when i am querying the table i can able to fetch data for the any record but when i am using the below mentioned query for the same i am getting the error.As i am doing this to fecth the data for child parent related relationship.
Can any one suggest is there anything related to configaration or something else.
Please do let me know if you do want some more information on the query what i am doing inside of it.
Rgds,
Anit
Edited by: Anit A. on Sep 1, 2008 2:32 AM
Edited by: Anit A. on Sep 1, 2008 2:33 AMWITH t
AS
SELECT decode(t.spnlevel
,3,t.u_quotesdtlid
,2,decode((select count(*)
from u_quotesdtl t2
where t2.u_quotesdtlid = t.u_quotesdtlid
and t2.parentspn = (t2.jobgroupid||':'||t2.jobtype)
),0,(select t1.u_quotesdtlid
from u_quotesdtl t1
where t1.spnitemcode = t.parentspn
and t1.spnlevel = '3'
and t1.jobtype = t.jobtype
and t1.jobgroupid = t.jobgroupid
and t1.QUOTEID = t.QUOTEID
),t.u_quotesdtlid
,1,decode((select count(*)
from u_quotesdtl t2
where t2.QUOTEID = t.QUOTEID
and t2.parentspn = (t2.jobgroupid||':'||t2.jobtype)
),0,t.u_quotesdtlid,decode((select count(*)
from u_quotesdtl t3
where t3.QUOTEID = t.QUOTEID
and t3.parentspn = (t3.jobgroupid||':'||t3.jobtype)
and t3.u_quotesdtlid in (select t1.u_quotesdtlid
from u_quotesdtl t1
where t1.spnitemcode = t.parentspn
and t1.spnlevel = '2'
and t1.jobtype = t.jobtype
and t1.jobgroupid = t.jobgroupid
and t1.QUOTEID = t.QUOTEID
),0,(select t4.u_quotesdtlid
from u_quotesdtl t4
,(select t1.parentspn
,t1.jobtype
,t1.jobgroupid
from u_quotesdtl t1
where t1.spnitemcode = t.parentspn
and t1.spnlevel = '2'
and t1.jobtype = t.jobtype
and t1.jobgroupid = t.jobgroupid
and t1.QUOTEID = t.QUOTEID
) t5
where t4.spnitemcode = t5.parentspn
and t4.spnlevel = '3'
and t4.jobtype = t5.jobtype
and t4.jobgroupid = t5.jobgroupid
and t4.QUOTEID = t.QUOTEID
(select t1.u_quotesdtlid
from u_quotesdtl t1
where t1.spnitemcode = t.parentspn
and t1.spnlevel = '2'
and t1.jobtype = t.jobtype
and t1.jobgroupid = t.jobgroupid
and t1.QUOTEID = t.QUOTEID
,null,t.u_quotesdtlid) as parentquoteid
,t.u_quotesdtlid as quotesdtlid
,t.spnlevel as spnlevel
FROM u_quotesdtl t
WHERE t.QUOTEID ='som key id'
ORDER BY parentquoteid,t.spnlevel desc
select * from t; -
'ORA-01722: Invalid Number' error while Running a Query
Hi,
I'm trying to run a query built on a DSO. The DSO has a field 'Start Date'. This Start Date InfoObject has a reference Char as 0DATE.
This Start Field has blank values due to which I'm getting the ORA-01722 error. I came across many threads with same topic of discussion. As mentioned in one of the Threads I have written a program to update 'Start Date' with 00000000. The code wriiten is "UPDATE /BIC/AZ_MONINV00 SET /BIC/ZSTR_DTE = '00000000' where /BIC/ZSTR_DTE = ' '.
Now when I see the data in the active data table of DSO the blank value is replaced with '00000000'.
But If I right click on the DSO click on display data the 'Start Date' field is blank. And now the Query also gets executed without any error. But in the output of the query the 'Start Date' Field has "#" values.
Can anyone suggest on how can I make these "#" values appear as 00000000 in the report?In this case, you have to write a macro to avoid # in Analyzer.
Right Click-->Display Data will show data from Active table of DSO only.
If you don't want to show any blank date values in the report, you can exclude in Filter in Query.
Maybe you are looking for
-
Lexmark Printer issues since downloading OS 10.6.8
I have recently updated my Apple OS system to 10.6.8 and now my Lexmark x4650 wont print, although it will still scan any ideas how to resolve this issue?
-
Pivotetable in measure column link to another column
i am taking pivote table in pivote column year ,*row* deptno , measure count(Admin.deptid) total employees in depotment wise in dashboard dipalyed year deptone depttwo deptthree deptfoure 2000 45 55 65 75 2001 40 65 75 85 45 results come [ count(Admi
-
Premiere CS6 crashes EVERYTIME I try to close it.
Why why why why why why why why? it's sooooooooooooooooooooo Dull!
-
ok firefox updated this morning without me agreeing to it. once updated i notice the page i was on the font is huge. I then check in to facebook to find that page is totally different with regard to font size and form size . the games i play on there
-
I was trying to change my apple store a couple of time but until now I cannot access or update any of the apple service