Report6.0 Procedure FIND_REPORT_OBJECT
Hi
I have a problem with the procedure FIND_REPORT_OBJECT.
the procedure FIND_REPORT_OBJECT wrote in this way
repid := FIND_REPORT_OBJECT('c:\..\REPORTNAME');
return the error FRM-41219: Cannot find report: invalid ID.
The report is saved in the file system. Where is the error?
Thanks.
Regards
null
Raffaele Dei Campielisi (guest) wrote:
: Hi
: I have a problem with the procedure FIND_REPORT_OBJECT.
: the procedure FIND_REPORT_OBJECT wrote in this way
: repid := FIND_REPORT_OBJECT('c:\..\REPORTNAME');
: return the error FRM-41219: Cannot find report: invalid ID.
: The report is saved in the file system. Where is the error?
: Thanks.
: Regards
The parameter that you pass to FIND_REPORT_OBJECT should be the
name of the report object that you attached in your Form
Designer under the Reports node. So you cannot use the actual
file name in this built-in. The file name is one of the
properties of the report object. Hope this helps.
Yar
null
Similar Messages
-
Need help to fix the Procedure
I found a procedure in the forum. I think Vikash posted this. I update and it is working for comma delimiter records but I want to work it for TAB delimiter. I edited many ways but no luck. If any body fix it, please help so.
Thanks,
Lubna
create or replace PACKAGE htmldb_tools
AS
PROCEDURE parse_textarea (
p_textarea IN VARCHAR2,
p_collection_name IN VARCHAR2
PROCEDURE parse_file(
p_file_name IN VARCHAR2,
p_collection_name IN VARCHAR2,
p_headings_item IN VARCHAR2,
p_columns_item IN VARCHAR2,
p_ddl_item IN VARCHAR2,
p_table_name IN VARCHAR2 DEFAULT NULL
create or replace PACKAGE BODY htmldb_tools
AS
TYPE varchar2_t IS TABLE OF VARCHAR2(32767) INDEX BY binary_integer;
PROCEDURE delete_collection (
p_collection_name IN VARCHAR2
IS
BEGIN
IF (htmldb_collection.collection_exists(p_collection_name))
THEN
htmldb_collection.delete_collection(p_collection_name);
END IF;
END delete_collection;
PROCEDURE csv_to_array (
p_csv_string IN VARCHAR2,
p_array OUT wwv_flow_global.vc_arr2,
p_separator IN VARCHAR2 := 'chr(09)'
IS
l_start_separator PLS_INTEGER := 0;
l_stop_separator PLS_INTEGER := 0;
l_length PLS_INTEGER := 0;
l_idx BINARY_INTEGER := 0;
l_quote_enclosed BOOLEAN := FALSE;
l_offset PLS_INTEGER := 1;
BEGIN
l_length := NVL(LENGTH(p_csv_string),0);
IF (l_length <= 0)
THEN
RETURN;
END IF;
LOOP
l_idx := l_idx + 1;
l_quote_enclosed := FALSE;
IF SUBSTR(p_csv_string, l_start_separator + 1, 1) = '"'
THEN
l_quote_enclosed := TRUE;
l_offset := 2;
l_stop_separator := INSTR(p_csv_string, '"', l_start_separator + l_offset, 1);
ELSE
l_offset := 1;
l_stop_separator := INSTR(p_csv_string, p_separator, l_start_separator + l_offset, 1);
END IF;
IF l_stop_separator = 0
THEN
l_stop_separator := l_length + 1;
END IF;
p_array(l_idx) := (SUBSTR(p_csv_string, l_start_separator + l_offset,(l_stop_separator - l_start_separator - l_offset)));
EXIT WHEN l_stop_separator >= l_length;
IF l_quote_enclosed
THEN
l_stop_separator := l_stop_separator + 1;
END IF;
l_start_separator := l_stop_separator;
END LOOP;
END csv_to_array; --}}}
PROCEDURE get_records(p_blob IN blob,p_records OUT varchar2_t) --{{{
IS
l_record_separator VARCHAR2(2) := chr(13)||chr(10);
l_last INTEGER;
l_current INTEGER;
BEGIN
IF (NVL(dbms_lob.instr(p_blob,utl_raw.cast_to_raw(l_record_separator),1,1),0)=0)
THEN
l_record_separator := chr(10);
END IF;
l_last := 1;
LOOP
l_current := dbms_lob.instr( p_blob, utl_raw.cast_to_raw(l_record_separator), l_last, 1 );
EXIT WHEN (nvl(l_current,0) = 0);
p_records(p_records.count+1) := utl_raw.cast_to_varchar2(dbms_lob.substr(p_blob,l_current-l_last,l_last));
l_last := l_current+length(l_record_separator);
END LOOP;
END get_records;
PROCEDURE parse_textarea (
p_textarea IN VARCHAR2,
p_collection_name IN VARCHAR2
IS
l_index INTEGER;
l_string VARCHAR2(32767) := TRANSLATE(p_textarea,chr(9)||chr(13)||chr(10)||' ,','@@@@');
l_element VARCHAR2(100);
BEGIN
l_string := l_string||'@';
htmldb_collection.create_or_truncate_collection(p_collection_name);
LOOP
l_index := instr(l_string,'@');
EXIT WHEN NVL(l_index,0)=0;
l_element := substr(l_string,1,l_index-1);
IF (trim(l_element) IS NOT NULL)
THEN
htmldb_collection.add_member(p_collection_name,l_element);
END IF;
l_string := substr(l_string,l_index+1);
END LOOP;
END parse_textarea;
PROCEDURE parse_file(
p_file_name IN VARCHAR2,
p_collection_name IN VARCHAR2,
p_headings_item IN VARCHAR2,
p_columns_item IN VARCHAR2,
p_ddl_item IN VARCHAR2,
p_table_name IN VARCHAR2 DEFAULT NULL
IS
l_blob blob;
l_records varchar2_t;
l_record wwv_flow_global.vc_arr2;
l_datatypes wwv_flow_global.vc_arr2;
l_headings VARCHAR2(4000);
l_columns VARCHAR2(4000);
l_seq_id NUMBER;
l_num_columns INTEGER;
l_ddl VARCHAR2(4000);
BEGIN
IF (p_table_name is not null)
THEN
l_ddl := 'insert into '||p_table_name||' '||
'select '||v(p_columns_item)||' '||
'from htmldb_collections '||
'where seq_id > 0 and collection_name='''||p_collection_name||'''';
htmldb_util.set_session_state('P149_DEBUG',v('P149_DEBUG')||'/'||l_ddl);
execute immediate l_ddl;
RETURN;
END IF;
BEGIN
select blob_content into l_blob from wwv_flow_files
where name=p_file_name;
EXCEPTION
WHEN NO_DATA_FOUND THEN
raise_application_error(-20000,'File not found, id='||p_file_name);
END;
get_records(l_blob,l_records);
IF (l_records.count < 2)
THEN
raise_application_error(-20000,'File must have at least 3 ROWS, id='||p_file_name);
END IF;
htmldb_collection.create_or_truncate_collection(p_collection_name);
csv_to_array(l_records(1),l_record);
l_num_columns := l_record.count;
if (l_num_columns > 900000) then
raise_application_error(-900000,'Max. of 9,000,00 columns allowed, id='||p_file_name);
end if;
FOR i IN 1..l_record.count
LOOP
l_headings := l_headings||':'||l_record(i);
l_columns := l_columns||',c'||lpad(i,3,'0');
END LOOP;
l_headings := ltrim(l_headings,':');
l_columns := ltrim(l_columns,',');
htmldb_util.set_session_state(p_headings_item,l_headings);
htmldb_util.set_session_state(p_columns_item,l_columns);
FOR i IN 2..l_records.count
LOOP
csv_to_array(l_records(i),l_record);
l_seq_id := htmldb_collection.add_member(p_collection_name,'dummy');
FOR i IN 1..l_record.count
LOOP
htmldb_collection.update_member_attribute(
p_collection_name=> p_collection_name,
p_seq => l_seq_id,
p_attr_number => i,
p_attr_value => l_record(i)
END LOOP;
END LOOP;
DELETE FROM wwv_flow_files WHERE name=p_file_name;
END;
BEGIN
NULL;
END;sir manu,
i started the oracleAS report Server with the following command in command prompt : rwserver server=rep_myserver
and it successfully started.
i insert this code on my button :
DECLARE
RO_Report_ID REPORT_OBJECT;
Str_Report_Server_Job VARCHAR2(100);
Str_Job_ID VARCHAR2(100);
Str_URL VARCHAR2(100);
PL_ID PARAMLIST ;
BEGIN
PL_ID := GET_PARAMETER_LIST('TEMPDATA');
IF NOT ID_NULL(PL_ID) THEN
PAUSE;
DESTROY_PARAMETER_LIST(PL_ID);
END IF;
PL_ID := CREATE_PARAMETER_LIST('TEMPDATA');
--RO_Report_ID := FIND_REPORT_OBJECT('REPORT_OBJ');
RO_Report_ID := FIND_REPORT_OBJECT('REPORT1');
ADD_PARAMETER(PL_ID, 's_sin_no', TEXT_PARAMETER,:scrap_delivery_request.sin_no);
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_FILENAME, 'C:\New Forms\REF_SF_510.ref');
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_COMM_MODE, SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_EXECUTION_MODE, BATCH);
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_DESTYPE, cache);
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_DESFORMAT, 'PDF');
SET_REPORT_OBJECT_PROPERTY(RO_Report_ID, REPORT_SERVER, 'rep_myserver');
Str_Report_Server_Job := RUN_REPORT_OBJECT(RO_Report_ID, PL_ID);
Str_Job_ID := SUBSTR(Str_Report_Server_Job, LENGTH('rep_myserver') + 2, LENGTH(Str_Report_Server_Job));
Str_URL := '/reports/rwservlet/getjobid' || Str_Job_ID || '?server=' || 'rep_myserver';
WEB.SHOW_DOCUMENT(Str_URL, '_SELF');
DESTROY_PARAMETER_LIST(PL_ID);
END;
after pressing the button this error come up in browser :
REP-52251: Cannot get output of job ID 3 you requested on SAt. jul 04 11:44...... <P> REP-51026 :No output for job b -
How to open report in the browser from PL/SQL procedure
Hi,
I need to call the report (with destype = SCREEN) from the PL/SQL procedure and display in the browser.
For Example: when I call P_call_report procedure in my Forms6i button or at sql*plus, the report output PDF/HTML should open in the Browser window.
Iam Using IE, report6i, forms 6i, Oracle 8.1.7, Windows OS
I tried using UTL_HTTP(' ') in a procedure. But when I execute the procedure at sql*plus it says Pl/sql procedure completed successfully message without opening report output in the browser window. If I copy the same url and paste it in the browser, it works.
Please let me know if there is any solution.
thanks alot.I guess event driven publishing may work. But Iam not sure about the opening of the browser from inside the procedure.
-
9iDS - FIND_REPORT_OBJECT doesn't find report
What do I need to do to have FIND_REPORT_OBJECT be able to find a report? Can I specify a full path or do I need to set some configuration file to point to where it is?
Here's the code I'm using to run a report from a form.
PROCEDURE do_print2 IS
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
BEGIN
repid := FIND_REPORT_OBJECT('module2');
v_rep := RUN_REPORT_OBJECT(repid);
END;Mark,
I think that the usage of fin_report_object is wrong.
PROCEDURE do_print2 IS
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
BEGIN
repid := FIND_REPORT_OBJECT('module2');
v_rep := RUN_REPORT_OBJECT(repid);
END;
If module2 is the actual name of the Report definition file, then the usage is not correct. In Forms you create a Reports node. This Reports node then takes the Reports module name as a property. In find_report_object( ) you specify the Reports node name as a value.
E.g. if you created a Reports node in Forms with the name of "myReps" then your code sequence looks like this
PROCEDURE do_print2 IS
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
BEGIN
repid := FIND_REPORT_OBJECT('myReps');
v_rep := RUN_REPORT_OBJECT(repid);
END;
The Reports node needs also to define the Reports Server name used if not set by set_report_object_property(repid,REPORT_SERVER, <name here>);
Please have a look at the Reports integration Whitepaper written for Forms6i/Reports6i. As far as the Run_Report_Object usage goes, it is still valid.
http://otn.oracle.com/products/forms/pdf/277282.pdf
Please note that Oracle Reports web reports (jsp files) cannot be used with run_report_object in Forms
Frank -
Find_report_object('rp2rro') how can this work?
Hi
I've spent a long time looking thru metalink (now Support) at the various posts and documents on calling reports from forms using the run_report_object that the translator replaces run_product with, and here and I'm frankly still looking for direction .
This code is in rp2rro.pll and of course dies, as there is no rp2rro report
rp2rroNodeId Report_Object :=find_report_object('rp2rro');
I have a menu that calls something called execute_report with just a report name (e.g. end_month_report). execute_report is in a user library and contains a call to rp2rrro. It looks like this
PROCEDURE execute_report(i_report IN VARCHAR2) IS
-- Code modified by the Forms Migration Assistant
-- 11-Jan-2011 01:58 PM
BEGIN
SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'BUSY');
RP2RRO.RP2RRO_RUN_PRODUCT(REPORTS, i_report, SYNCHRONOUS, RUNTIME, FILESYSTEM);
SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
END;
Can anyone suggest a way to make this work without modifying the forms?
Looking at Rp2rro, it uses rp2rroNodeId throughout..
Thanks for any suggestionsWell almost a year later, the dummy form solution has been working well with 11GR1, but I have some issues understanding how to make the dummy form call reports using parameters passed in the rp2rro call using this approach
If a form calls the dummy form with a parameter list containing e.g. start_date, end_date etc then the problem is that the dummy form doesn't have those parameters defined because it can be called from many different forms each with its own set of parameters.
As I read in the 6i doc "+When passing the default parameter list as well as any other parameter list, make sure that every parameter exists with the same name in the called form"+ which doesn't work as the dummy form doesn't have those parameters defined.
I'm trying to centralize all the rp2rro report invocations so that developers don't have to add the web.show_document and the hidden values and the rest of that logic to bring a PDF form back into the web browser
I'm trying out a number of things but would be interested if anyone has any comments.. -
Pricing procedure of free goods
Could anyone please tell me the effect of pricing procedure in free godds?And what is the difference between pricing procedure in free goods(IMG->Sales and Distribution->Basic Funcions->Free Goods) and pricing procedure in pricing(IMG->Sales and Distribution->Basic Funcions->Pricing)
Hi Wei Zhang,
When there are more than 2 materials say material A which is of some price, and material B which is Free of cost, then the item category will be different for those. TAN for Mat A and TANN for materail B.
Pricing is depends upon the customer pricing procedure and document pricing procedure along with the Sales Area.
When there are free Goods, Again yu have two conditions
1. Give 100 % discount on free goods.
2. Or charge 0 value for that.
This pricing procedure you can do in free goods priocing procedure.
Hope this will help.
Thanks,
Raja -
Can not select from data dictionary view from a procedure
Hi,
I wonder, which privilege is missing here:
my schema has this roles and privs:
GRANT CONNECT, RESOURCE TO cb ;
GRANT CREATE SESSION TO cb ;
GRANT SELECT_CATALOG_ROLE TO cb ;
GRANT CREATE SYNONYM TO CB;
GRANT CREATE VIEW TO CB;
I create a procedure:
create or replace procedure dd_test as
begin
dbms_output.enable(2000000);
for r in (select table_name from sys.dba_tab_partitions where owner = 'CB') loop
dbms_output.put_line(r.table_name);
end loop;
end;
sho err
4/38 PL/SQL: ORA-00942: table or view does not exist
When I run the core statement form sql prompt, it works !
so what privilege is missing here ???
thanks for any hint, Lao DeHi,
thanks for that reply, after doing that I can not select this DD-view from sql-prompt anymore (which I don't wonder ;-). Can you tell me, what idea you had behind that test ?
I found another instance, where the procedure works and I will compare those privileges, but it's hard to sort out that complex structure of nested roles and sys_privs.
How ever, I will update here, when I found the missing privilege.
regards LaoDe -
Unable to capture the parameter values from a PL/SQL procedure
hi.
i'm trying to capture the parameter values of a PL/SQL procedure by calling inside a anonymous block but i'm getting a "reference to uninitialized collection error" ORA-06531.
Please help me regarding.
i'm using following block for calling the procedure.
declare
err_cd varchar2(1000);
err_txt VARCHAR2(5000);
no_of_recs number;
out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
cntr_var number:=0;
begin
rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
dbms_output.put_line('The error is ' ||err_cd);
dbms_output.put_line('The error is ' ||err_txt);
dbms_output.put_line('The cntr is ' ||cntr_var);
for incr in 1 .. OUT_SIGN_TAB.count
loop
cntr_var := cntr_var + 1 ;
Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN_TAB(incr).txn_type||','||OUT_SIGN_TAB(incr).objid);
end loop;
end;
Error is thrown on "for incr in 1 .. OUT_SIGN_TAB.count" this line
Following is some related information.
the 3rd parameter of the procedure is a out parameter. it is a type of a PL/SQL table (SEARCH_SIGN_TAB_TYPE) which is available in database as follows.
TYPE "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
TYPE "SEARCH_SIGN_TYPE" AS OBJECT
(ref_no VARCHAR2(22),
ciref_no VARCHAR2(352),
ac_no VARCHAR2(22),
txn_type VARCHAR2(301),
objid VARCHAR2(1024))............We don't have your rt843pq procedure, but when commenting that line out, everything works:
SQL> create TYPE "SEARCH_SIGN_TYPE" AS OBJECT
2 (ref_no VARCHAR2(22),
3 ciref_no VARCHAR2(352),
4 ac_no VARCHAR2(22),
5 txn_type VARCHAR2(301),
6 objid VARCHAR2(1024))
7 /
Type is aangemaakt.
SQL> create type "SEARCH_SIGN_TAB_TYPE" IS TABLE OF SEARCH_SIGN_TYPE
2 /
Type is aangemaakt.
SQL> declare
2 err_cd varchar2(1000);
3 err_txt VARCHAR2(5000);
4 no_of_recs number;
5 out_sign_tab search_sign_tab_type:=search_sign_tab_type(search_sign_type(NULL,NULL,NULL,NULL,NULL));
6 cntr_var number:=0;
7 begin
8 -- rt843pq('DWS','3000552485',out_sign_tab,no_of_recs,err_cd,err_txt);
9 dbms_output.put_line('The error is ' ||err_cd);
10 dbms_output.put_line('The error is ' ||err_txt);
11 dbms_output.put_line('The cntr is ' ||cntr_var);
12 for incr in 1 .. OUT_SIGN_TAB.count
13 loop
14 cntr_var := cntr_var + 1 ;
15 Dbms_output.put_line(OUT_SIGN_TAB(incr).ref_no||','||OUT_SIGN_TAB(incr).ciref_no||','||OUT_SIGN_TAB(incr).ac_no||','||OUT_SIGN
TAB(incr).txntype||','||OUT_SIGN_TAB(incr).objid);
16 end loop;
17 end;
18 /
The error is
The error is
The cntr is 0
PL/SQL-procedure is geslaagd.Regards,
Rob. -
Get Attribute values from a page and procedure exception handling?
Hi All,
I have created new page with two input attributes not based on any VO. This page is created to capture two values and pass these to an AM method upon pressing OK button. The method in AM will call a procedure with two in parameter expecting the two values captured from the above said page.
I have two questions, first one how to capture the values entered by the page in the controller class and advises me how to handle exceptions when my procedure fails.
I can not use something like this since this page is not based on a VO
String fromName = (String)vo.getCurrentRow().getAttribute("FromName");
Do I have to create a dummy VO like select '' name1, '' name2 from dual?
Thanks for the help.Hi,
Actually you can capture the parameters on the page like this way
String test = (String)pageContext.getParameter("id of the text input bean");
Now in procedure you can take an out parameter which stores the error messages on exception
and return that out parameter in java.
and then you can throw exception on page using OAException class.
Thanks
Gaurav Sharma -
Get variable values from a stored procedure
I am using SQL 2008R2 and I want to replace a view inside a stored procedure with a new stored procedure to return multiple variable values. Currently I am using the code below to get values for 4 different variables. I would rather get the 4 variables
from a stored procedure (which returns all of these 4 values and more) but not sure how to do so. Below is the code for getting the 4 variable values in my current sp.
DECLARE @TotalCarb real;
DECLARE @TotalPro real;
DECLARE @TotalFat real;
DECLARE @TotalLiquid real;
SELECT @TotalCarb = ISNULL(TotCarb,0),
@TotalPro = ISNULL(TotPro,0),
@TotalFat = ISNULL(TotFat,0),
@TotalLiquid = ISNULL(TotLiq,0)
FROM dbo.vw_ActualFoodTotals
WHERE (MealID = @MealID);You can replace the view with inline table valued user-defined function:
http://www.sqlusa.com/bestpractices/training/scripts/userdefinedfunction/
See example: SQL create INLINE table-valued function like a parametrized view
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
Pointbase : How can I create a stored procedure with Pointbase database?
Hello,
Excuse me for my english, I'm not anglophone. I try to create a stored procedure.
This is my file SampleExternalMethods.java :
import java.sql.*; //import com.pointbase.jdbc.jdbcInOutDoubleWrapper; public class SampleExternalMethods { // A connection object to allow database callback static Connection conn = null; static Statement l_stmt; static Statement m_stmt; static CallableStatement m_callStmt = null; static ResultSet l_rs = null; public static void main(String[] args) { try { String url = "jdbc:pointbase:server://localhost/pointbaseDB"; String username = "PBPUBLIC"; String password = "PBPUBLIC"; conn = DriverManager.getConnection(url, username, password); doCreateProcedure(); doInvokeProcedure(); } catch (SQLException e) { e.printStackTrace(); } finally { if (m_stmt != null) { try { m_stmt.close(); } catch (Exception e) { e.printStackTrace(); } } if (m_callStmt != null) { try { m_callStmt.close(); } catch (Exception e) { e.printStackTrace(); } } if (conn != null) { try { conn.close(); } catch (Exception e) { e.printStackTrace(); } } } } public static void getCountry(String Iso_Code) { try { // Query the database for the country iso code l_stmt = conn.createStatement(); l_rs = l_stmt.executeQuery( "SELECT * FROM countries" + " WHERE country_iso_code ='" + Iso_Code + "'"); //Affichage du résultat de la requête l_rs.next(); System.out.print(l_rs.getString(1) + " - "); System.out.print(l_rs.getString(2) + " - "); System.out.println(l_rs.getString(3)); // Close the result set l_rs.close(); } catch (SQLException e) { e.printStackTrace(); } finally { if (l_rs != null) { try { l_rs.close(); } catch (Exception e) { e.printStackTrace(); } } if (l_stmt != null) { try { l_stmt.close(); } catch (Exception e) { e.printStackTrace(); } } } } public static void doCreateProcedure() throws SQLException { // SQL statement to create a stored procedure String SQL_CREATE_PROC = "CREATE PROCEDURE getCountry(IN P1 VARCHAR(30))" + " LANGUAGE JAVA" + " SPECIFIC getCountry" + " NO SQL" + " EXTERNAL NAME \"SampleExternalMethods::getCountry\"" + " PARAMETER STYLE SQL"; // Create a SQL statement m_stmt = conn.createStatement(); // Execute the SQL m_stmt.executeUpdate(SQL_CREATE_PROC); // Close the statement //m_stmt.close(); } public static void doInvokeProcedure() throws SQLException { // Create SQL to invoke stored procedures String SQL_USE_PROC = "{ call getCountry(?) }"; // Create a callable statement with three binding parameters m_callStmt = conn.prepareCall(SQL_USE_PROC); m_callStmt.setString(1, "CA"); m_callStmt.executeQuery(); // Close the callable statement //m_callStmt.close(); } }
Afterwards, I have read this note in a Pointbase document:
To invoke the dateConvert external Java method from a stored function, you must use the
CREATE FUNCTION statement. The dateConvert external Java method is called from the
class, SampleExternalMethods.
In order for the database to access this external Java method, the class SampleExternalMethods
must be included in the database CLASSPATH. For PointBase Embedded - Server Option, it
must be in the Server CLASSPATH, but not in the Client CLASSPATH.
If PointBase Server is run with the Java Security Manager, in the java policy file grant
’com.pointbase.sp.spPermission’ to the class that implements the external Java method.
An "spPermission" consists of a class name with no action. The class name is a name of a class
that could be used in creating a Stored Procedure in PointBase. The naming convention follows
the hierarchical property naming convention and that is supported by
"java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded
by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
contain any white spaces.
I'm not sure, but I suppose that I must include the class SampleExternalMethods in a .jar file.
The database CLASSPATH could be : C:\Sun\AppServer\pointbase\lib\
These my files in this database CLASSPATH:
pbclient.jar
pbembedded.jar
pbtools.jar
pbupgrade.jar
I have tryed to include the class SampleExternalMethods in pbclient.jar and pbembedded.jar with this command:
jar -uf pbembedded.jar SampleExternalMethods
Afterwards I do that,
1) Start Pointbase
2) Configuration of classpath
set classpath=C:\Sun\AppServer\pointbase\lib\pbclient.jar
set classpath=%classpath%;D:\J2EE\Ch07Code\Ch07_06
I precise that my file SampleExternalMethods is into D:\J2EE\Ch07Code\Ch07_06\Ch07.
Then, I run the program:
D:\J2EE\Ch07Code\Ch07_06>java -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver Ch07.SampleExternalMethods
But I have an error message:
Exception in thread "main" java.lang.NoClassDefFoundError: Ch07.SampleExternalMethods (wrong name: SampleExternalMethods)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.DefineClass(ClassLoader.java:539)
The problem, I suppose, comes from that the class SampleExternalMethods
must be included in the database CLASSPATH, but there is a pbserver.jar with pointbase normally, but I didn't find it. That's why I use pbembedded.jar or pbclient.jar in order to include the class SampleExternalMethods. May be I must start from C:\Sun\AppServer\pointbase\lib\ instead of D:\J2EE\Ch07Code\Ch07_06\Ch07?
Please, can somebody helps me?
Thank you in advance.
cagou!jschell wrote:
And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
>And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
>
And I doubt you can recurse like that for embedded java. You must have a class that does the functionality and another class that creates the proc.
Thank you for your response, I have done two classes:
SampleExternalMethods.java:
package Ch07;
import java.sql.*;*
*public class SampleExternalMethods*
*public static void getCountry(String Iso_Code)*
*// A connection object to allow database callback*
*Connection l_conn = null;*
*Statement l_stmt = null;*
*ResultSet l_rs = null;*
*try*
*String url = "jdbc:pointbase:server://localhost/pointbaseDB";*
*String username = "PBPUBLIC";*
*String password = "PBPUBLIC";*
*l_conn = DriverManager.getConnection(url, username, password);*
*// Query the database for the country iso code*
*l_stmt = l_conn.createStatement();*
*l_rs = l_stmt.executeQuery( "SELECT* FROM PBPUBLIC.COUNTRIES"
+" WHERE country_iso_code ='"+ Iso_Code +"'");+
+//Affichage du résultat de la requête+
+l_rs.next();+
+System.out.print(l_rs.getString(1)+ " - ");
System.out.print(l_rs.getString(2) +" - ");+
+System.out.println(l_rs.getString(3));+
+// Close the result set+
+l_rs.close();+
+} catch (SQLException e) {+
+e.printStackTrace();+
+} finally {+
+if (l_rs != null) {+
+try {+
+l_rs.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+if (l_stmt != null) {+
+try {+
+l_stmt.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+if (l_conn != null) {+
+try {+
+l_conn.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+}+
+}+
+}+
CreateMethods.java:
+package Ch07;+
+import java.sql.*;+
+public class CreateMethods+
+{+
+// A connection object to allow database callback+
+static Connection m_conn = null;+
+static Statement m_stmt;+
+static CallableStatement m_callStmt = null;+
+public static void main(String[] args)+
+{+
+try+
+{+
+String url = "jdbc:pointbase:server://localhost/pointbaseDB";+
+String username = "PBPUBLIC";+
+String password = "PBPUBLIC";+
+m_conn = DriverManager.getConnection(url, username, password);+
+doCreateProcedure();+
+doInvokeProcedure();+
+} catch (SQLException e) {+
+e.printStackTrace();+
+} finally {+
+if (m_stmt != null) {+
+try {+
+m_stmt.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+if (m_callStmt != null) {+
+try {+
+m_callStmt.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+if (m_conn != null) {+
+try {+
+m_conn.close();+
+} catch (Exception e) {+
+e.printStackTrace();+
+}+
+}+
+}+
+}+
+public static void doCreateProcedure() throws SQLException {+
+// SQL statement to create a stored procedure+
+String SQL_CREATE_PROC = "CREATE PROCEDURE PBPUBLIC.getCountry(IN P1 VARCHAR(30))"+
" LANGUAGE JAVA"
+" SPECIFIC getCountry"+
" NO SQL"
+" EXTERNAL NAME \"SampleExternalMethods::getCountry\""+
" PARAMETER STYLE SQL";
// Create a SQL statement
m_stmt = m_conn.createStatement();
// Execute the SQL
m_stmt.executeUpdate(SQL_CREATE_PROC);
// Close the statement
//m_stmt.close();
public static void doInvokeProcedure() throws SQLException {
// Create SQL to invoke stored procedures
String SQL_USE_PROC = "{ call getCountry(?) }";
// Create a callable statement with three binding parameters
m_callStmt = m_conn.prepareCall(SQL_USE_PROC);
m_callStmt.setString(2, "CA");
m_callStmt.executeQuery();
// Close the callable statement
//m_callStmt.close();
}But I have the same error message that previously.
I have read this note and I suppose that the problem is linked:
If PointBase Server is run with the Java Security Manager, in the java policy file grant
*com.pointbase.sp.spPermission to the class that implements the external Java method.*
An "spPermission" consists of a class name with no action. The class name is a name of a class
that could be used in creating a Stored Procedure in PointBase. The naming convention follows
the hierarchical property naming convention and that is supported by
*"java.security.BasicPermission". An asterisk may appear by itself, or if immediately preceded*
by ".", may appear at the end of the name, to signify a wildcard match. The name cannot
contain any white spaces.
Can you explain me what I must to do in order to solve this problem of spPermission.
Thanks. -
How to view the returned data from a stored procedure in TOAD?
Hi,
I created ref cursor in the stored procedure to return data. The stored procedure works fine, just want to view the result in TOAD. The BEGIN... EXEC... END can execute the stored procedure, but how to make the result display?
Thanks!Right click the editor and choose
"Prompt For Substitution Variables".
Run for example the following code:
DECLARE
PROCEDURE p (cur OUT sys_refcursor)
AS
BEGIN
OPEN cur FOR
SELECT *
FROM DUAL;
END p;
BEGIN
p (:cur);
END;
The result will display in Toad's Data Grid!
Regards Michael -
Error while running a stored procedure in SBO
Hi all,
i have a stored procedure that i run in my sbo. When i run the stored procedure i get the following error :
1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Warning: Null value is eliminated by an aggregate or other SET operation.
'Servicecontracten' (OCTR) 05/10/2011 18:03:36 -1
i launch my sp like this :
exec [spu_DS_HistProjektUserVeldenViewBetalingen] (i pass no parameters while testing. i put them fix in my sp)
my stored procedure looks like this :
USE [def1]
GO
/****** Object: StoredProcedure [dbo].[spu_DS_HistProjektUserVeldenViewBetalingen] Script Date: 10/05/2011 18:03:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Batch submitted through debugger: SQLQuery2.sql|8|0|C:\Users\kvanhauwaert\AppData\Local\Temp\~vs2A98.sql
ALTER PROCEDURE [dbo].[spu_DS_HistProjektUserVeldenViewBetalingen]
/* @project_number varchar(20),
@billperiod_type varchar(10) */
AS
BEGIN
SELECT isnull(lijnnr,0) as lijnnr, isnull(fase,'') as fase, isnull(factuurbedrag,0) as factuurbedrag,
isnull(billperiod_type,'') as billperiod_type
INTO #tempDS_HistProjektUserVeldenViewBetalingen
FROM DS_HistProjektUserVeldenViewBetalingen t1
WHERE project_number = '08053A'
SELECT isnull(lijnnr,0) as lijnnr, isnull(fase,'') as fase , isnull(factuurbedrag,0) as factuurbedrag,
(select sum(isnull(factuurbedrag,0)) from #tempDS_HistProjektUserVeldenViewBetalingen where lijnnr <= t1.lijnnr) as lijntotaal,
(select sum(isnull(factuurbedrag,0)) from #tempDS_HistProjektUserVeldenViewBetalingen where lijnnr <= t1.lijnNr and billperiod_type = '110-01' ) as lijntotaalKetting
FROM #tempDS_HistProjektUserVeldenViewBetalingen t1
WHERE fase,'') is not null
ORDER BY t1.fase
DROP TABLE #tempDS_HistProjektUserVeldenViewBetalingen
END
GO
Somebody has a clue what i'm doing wrong ?
thnxThanks Gordon for your reply.
i've changed my sp to :
USE [def1]
GO
/****** Object: StoredProcedure [dbo].[spu_DS_HistProjektUserVeldenViewBetalingen] Script Date: 10/05/2011 18:56:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- Batch submitted through debugger: SQLQuery2.sql|8|0|C:\Users\kvanhauwaert\AppData\Local\Temp\~vs2A98.sql
CREATE PROCEDURE [dbo].[spu_DS_HistProjektUserVeldenViewBetalingen]
/* @project_number varchar(20),
@billperiod_type varchar(10) */
AS
BEGIN
SELECT isnull(lijnnr,0) as lijnnr, isnull(fase,'') as fase, isnull(factuurbedrag,0) as factuurbedrag,
isnull(billperiod_type,'') as billperiod_type
INTO #tempDS_HistProjektUserVeldenViewBetalingen
FROM DS_HistProjektUserVeldenViewBetalingen t1
WHERE isnull(project_number,'') = '08053A'
SELECT isnull(lijnnr,0) as lijnnr, isnull(fase,'') as fase , isnull(factuurbedrag,0) as factuurbedrag,
(select sum(isnull(factuurbedrag,0)) from #tempDS_HistProjektUserVeldenViewBetalingen where isnull(lijnnr,0) <= isnull(t1.lijnnr,0)) as lijntotaal,
(select sum(isnull(factuurbedrag,0)) from #tempDS_HistProjektUserVeldenViewBetalingen where isnull(lijnnr,0) <= isnull(t1.lijnNr,0) and isnull(billperiod_type,'') = '110-01' ) as lijntotaalKetting
FROM #tempDS_HistProjektUserVeldenViewBetalingen t1
WHERE isnull(fase,'') <> ''
ORDER BY t1.fase
DROP TABLE #tempDS_HistProjektUserVeldenViewBetalingen
END
GO
but that didn't solved my problem. Any other idea's ?
kind regards.
Kurt -
Error while opening two cursors in same procedure...
Hi :
I have written following Procedure:
Declare
procedure pro_canefortnight_master Is
kr_caneperiodid integer;
last_caneperiod_id number(10,0);
kr_forthnightid integer;
last_forthnight_id number(10,0);
ref_caneperiodid integer;
ref_seasonyrid integer;
ctr integer:= 1;
CURSOR comp_cur IS select * from CMS_SEASON_YEAR_MASTER ;
comp_rec comp_cur%ROWTYPE;
BEGIN
OPEN comp_cur;
FETCH comp_cur INTO comp_rec;
WHILE comp_cur%FOUND
LOOP
kr_caneperiodid:= comp_rec.SEASON_YR_ID;
select max(crayom_db.cr_cane_calender.cr_cane_calender_ID) into last_caneperiod_id from crayom_db.cr_cane_calender;
if last_caneperiod_id <> 0 then
last_caneperiod_id:= last_caneperiod_id + 1;
else
last_caneperiod_id:= 1000000;
end if;
insert into crayom_db.CR_CANE_CALENDER(cr_cane_calender_ID,ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby,CR_CANE_CALENDER_NAME,DESCRIPTION) values(last_caneperiod_id,11,11,comp_rec.current_season,sysdate,100,sysdate,11,comp_rec.DESC_MA,comp_rec.DESC_EN);
COMMIT;
/*insert into crayom_db.CR_IdBackup(kr_cultivationtypeid,cr_cultivationtypeid) values(kr_cultivationtypeid, last_cultivationtype_id);*/
insert into crayom_db.temp(kr_bpartnerid,cr_bpartnerid) values(comp_rec.season_yr_id,last_caneperiod_id);
commit;
FETCH comp_cur INTO comp_rec;
End LOOP;
close comp_cur;
CURSOR comp_cur1 IS select * from CMS_FORTH_NIGHT_MASTER ;
comp_rec1 comp_cur1%ROWTYPE;
OPEN comp_cur1;
FETCH comp_cur1 INTO comp_rec1;
WHILE comp_cur1%FOUND
LOOP
kr_forthnightid:= comp_rec1.forthnight_id;
select max(crayom_db.cr_cane_calender_period.cr_cane_calender_period_ID) into last_forthnight_id from crayom_db.cr_cane_calender_period;
if last_forthnight_id <> 0 then
last_forthnight_id:= last_forthnight_id + 1;
else
last_forthnight_id:= 1000000;
end if;
if ref_seasonyrid <> comp_rec1.season_yr_id then
ref_seasonyrid:= comp_rec1.season_yr_id;
else
ctr:= ctr + 1;
end if;
SELECT cr_bpartnerid into ref_caneperiodid from crayom_db.temp where kr_bpartnerid = comp_rec1.season_yr_id;
dbms_output.put_line(ref_caneperiodid);
insert into crayom_db.CR_CANE_CALENDER_period(cr_cane_calender_period_ID,ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby,Enddate,name, startdate, cr_cane_calender_id) values(last_forthnight_id,11,11,comp_rec1.current_season,sysdate,100,sysdate,11,comp_rec1.end_date,'ForthNight' || ctr, comp_rec1.start_date,ref_caneperiodid);
commit;
FETCH comp_cur1 INTO comp_rec1;
End LOOP;
close comp_cur1;
END;
BEGIN
pro_canefortnight_master();
END;
But I am getting following Error:
Error report:
ORA-06550: line 429, column 8:
PLS-00103: Encountered the symbol "COMP_CUR1" when expecting one of the following:
:= . ( @ % ;
ORA-06550: line 433, column 1:
PLS-00103: Encountered the symbol "FETCH" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
The symbol "begi
ORA-06550: line 472, column 1:
PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
end not pragma final instantiable order overriding static
member constructor map
ORA-06550: line 477, column 4:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
end not pragma final instantiable order overriding static
member constructor map
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Can any body help me?
Thank You.
Edited by: [email protected] on Oct 22, 2009 4:36 AM[email protected] wrote:
CURSOR comp_cur1 IS select * from CMS_FORTH_NIGHT_MASTER ;
comp_rec1 comp_cur1%ROWTYPE;This is probably the issue. All variable definitions, including cursors, must be in the DEFINE section of a procedure (between either DECLARE ... BEGIN or AS/IS ... BEGIN).
In addition I wanted to note the following:
1. When posting it is helpful to identify your Oracle version (e.g. 10.2.0.4).
2. Any code that is posted should be placed between \ tags to improve readability.
3. It looks like the code is doing "slow by slow" processing (a.k.a single record processing). It could probably be made much cleaner, maintainable and better performing by possibly using INSERT .. AS SELECT ... or something along those lines. -
Error while deploying a Java Stored Procedure using JDeveloper
Hi,
I was going thru the Oracle By Example article: "Developing SQL and PL/SQL with JDeveloper". (http://www.oracle.com/technology/obe/obe9051jdev/ide1012/plsqlobe/obeplsql.htm)
One of the items in this article is - "Creating and Deploying a Java Stored Procedure"
I was able to create a java class, compile it. Created a deployment profile. created a pl/sql wrapper. While trying to deploy the java stored procedure, I am getting the following error:
Invoking loadjava on connection 'hr_conn' with arguments:
-order -resolve -thin
errors : class package1/mypackage/JavaStoredProc
ORA-29521: referenced name java/lang/StringBuilder could not be found
The following operations failed
class package1/mypackage/JavaStoredProc: resolution
oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:863)
at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116)
at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46)
at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:474)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:361)
at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:285)
at oracle.jdevimpl.deploy.StoredProcProfileDt$Action$1.run(StoredProcProfileDt.java:383)
#### Deployment incomplete. #### Oct 27, 2005 1:38:56 PM
Appreciate your help on this..I am using Jdeveloper 10.1.3 Early Access Version. JDK comes with it. I also have another JDK on my machine (JDK1.4.2_09)
Maybe you are looking for
-
How do I maintain quality when "importing an export"
Sounds like a weird question, but hear me out. I need to know if there is a specific way to maintain the quality level of a movie that I need to export, import into a new project and "re-export". Reason being that apparently iMovie '09 is broken and
-
What is the keyboard shortcut to view all text boxes?
what is the keyboard shortcut to view all text boxes? I have unwanted horizontal scrolling and it may be due to a wandering, forgotten textbox. thanks
-
Can't edit editable region in frames
Hello, my name is justine and i am trying to edit an area in the website i am making by using frames. I have made the #maincontent area editable and i can type in the area but it wont let me edit the CSS rule for #maincontent (text colour,size etc).
-
How to change content type from Document set to Item
While creating content type I've selected Item as a parent but after created I can see its showing Document Set as a parent content type. Now can anyone please suggest if possible I can change the parent content type from Document Set to Item.
-
Flash Player install -- error code 1041
I'm trying to upgrade my adobe flash player and it keeps giving me an error code of 1041. What is it and how can I fix it?