Error when calling Stored Procedure from backing bean
I am using Jdeveloper 11.1.1.6 and am trying to utilize the following URL to execute a SP from a backing bean: http://ramannanda.blogspot.com/2011/11/optimized-update-insert-adf.html
The reason I am looking at this is currently I have coded my backing bean to perform inserts and deletes through the use of my View Objects. I am performing up to a combined 5-10K inserts and deletes and the performance is rather slow. If there is a way to tune the view objects as well as the commit to be much faster, that is the prefered method. If that can't be done then I would like to figure out the approach identified in the URL.
I have highlighted a section of code below that is failing when using the URL approach. It errors out with the following exception: javax.el.ELException: oracle.jbo.JboException: java.sql.SQLException: Internal Error: Inconsistent catalog view
Do you have thoughts as to what might cause this exception.
create or replace
type TYP_TEST_R is object
Test_Id Number(5,0) ,
Test_Num Number(7,0)
create or replace
type TYP_TEST_TB as table of TYP_TEST_R;
private void myMethod(MyTableVORowImpl pCurrentRow) {
int i = 0;
DCIteratorBinding lDciter =
(DCIteratorBinding)getBindings().get("MyTable1Iterator");
MyAppModuleAMImpl lMyAppModuleAMImpl =
(MyAppModuleAMImpl)lDciter.getViewObject().getApplicationModule();
Connection lConnection =
lMyAppModuleAMImpl.getDBTransaction().createStatement(1).getConnection();
StructDescriptor lTblRecordStructType =
StructDescriptor.createDescriptor("DBADMIN.TYP_TEST_R",
lConnection);
.....<additional logic here>......
Object lArray[] = new Object[lSortedDifferences.size()];
while (........) {
Number lNumber = .......
Number lDifferentStore = (Number)lDifferentIterator.next();
STRUCT lTempStruct =+_
new STRUCT(lTblRecordStructType, lConnection,+_
*new Object[] { pCurrentRow.getTestId(),*+_
lDifferentStore });+_
lArray[i] = lTempStruct;
i = i + 1;
//create array structure descriptor
ArrayDescriptor lTableDesc =
ArrayDescriptor.createDescriptor("DBADMIN.TYP_TEST_TB",
lConnection);
//create an Array type with given structure definition
ARRAY lTableArray =
new ARRAY(lTableDesc, lConnection, lArray);
String lCallableProcedureStatement =
" begin DBADMIN.SP_TEST(?,?); end;";
OracleCallableStatement lOracleCallableStatement = null;
lOracleCallableStatement =
(OracleCallableStatement)lMyAppModuleAMImpl.getDBTransaction().createCallableStatement(lCallableProcedureStatement,
0);
lOracleCallableStatement.setARRAY(1, lTableArray);
lOracleCallableStatement.setString(2,
(String)ADFUtil.evaluateEL("#{sessionScope['UserName']}"));
lOracleCallableStatement.executeUpdate();
}
That was helpful and now I can execute up to my last line of code: "lOracleCallableStatement.executeUpdate();"
This code executes the SP.
My SP is as follows:
create or replace
PROCEDURE SP_TEST
*( param1 IN TYP_TEST_TB,*
param2 IN VARCHAR2) as
CURSOR for_insert_csr IS
SELECT *
FROM TABLE(param1) T1;
temp_update TYP_TEST_R;
BEGIN
FOR temp_update IN for_insert_csr
LOOP
-- do stuff in this loop
END LOOP;
end;
When trying to execute the SP, I get the following error:
+<LifecycleImpl> <_handleException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5+
javax.el.ELException: oracle.jbo.JboException: java.sql.SQLException: ORA-06550: line 1, column 7:*
PLS-00201: identifier DBADMIN.SP_TEST must be declared*
ORA-06550: line 1, column 7:*
PL/SQL: Statement ignored*
at com.sun.el.parser.AstValue.invoke(Unknown Source)*
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)*
at org.apache.myfaces.trinidad.component.UIXComponentBase.broadcastToMethodExpression(UIXComponentBase.java:1300)*
at oracle.adf.view.rich.component.UIXDialog.broadcast(UIXDialog.java:97)*
at oracle.adf.view.rich.component.fragment.UIXRegion.broadcast(UIXRegion.java:148)*
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)*
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)*
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)*
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:102)*
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:92)*
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:361)*
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:96)*
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:96)*
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.broadcastEvents(LifecycleImpl.java:1018)*
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:386)*
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:194)*
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)*
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)*
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)*
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)*
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)*
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)*
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)*
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)*
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)*
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)*
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)*
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)*
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)*
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)*
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)*
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)*
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:179)*
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)*
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)*
at java.security.AccessController.doPrivileged(Native Method)*
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)*
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)*
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)*
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)*
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)*
Do you have any suggestions on what I might want to try?
Similar Messages
-
Error while calling stored procedure from Java
Hi Guys,
How are you everybody? I hope everything is goin fine on your side. I have one issue in PL/SQL while calling below stored procedures from Java.
Problem Description: We have a stored procedure PROCEDURE BULK_INSERTS (
V_SESSION_ID_TAB IN T_SESSION_ID_TAB_TYPE,
V_SERVICE_TYPE_TAB IN T_SERVICE_TYPE_TAB_TYPE,
V_SERVICE_LOCATION_TAB IN T_SERVICE_LOCATION_TAB_TYPE,
V_SERVICE_CALL_NAME_TAB IN T_SERVICE_CALL_NAME_TAB_TYPE,
V_SERVICE_CALL_START_TIME_TAB IN T_SERVICE_CALL_ST_TAB_TYPE,
V_SERVICE_CALL_END_TIME_TAB IN T_SERVICE_CALL_ET_TAB_TYPE,
V_SERVICE_CALL_DURATION_TAB IN T_SERVICE_CALL_DUR_TAB_TYPE,
V_STATUS_TAB IN T_STATUS_TAB_TYPE,
V_NOTES_TAB IN T_NOTES_TAB_TYPE
) and we are getting ora errors while calling this stored procedure from java.
All tab types are declared locally, at package level.
Here is error which occur while calling this sp:
{call BULK_PKG.BULK_INSERTS(?,?,?,?,?,?,?,?,?)}
And the parameter types we are using are:
SESSION_ID - NUM_TAB_TYPE
SERVICE_TYPE - VAR_TAB_TYPE
SERVICE_LOCATION - VAR_TAB_TYPE
SERVICE_CALL_NAME - VAR_TAB_TYPE
SERVICE_CALL_START_TIME - DATE_TIME_TAB_TYPE
SERVICE_CALL_END_TIME - DATE_TIME_TAB_TYPE
SERVICE_CALL_DURATION - NUM_TAB_TYPE
STATUS - VAR_TAB_TYPE
NOTES - VAR_TAB_TYPE
And the Exception stack trace is:
ERROR (com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServi
ceCallDAO.java:143)@ExecuteThread: '252' for queue: 'weblogic.kernel.Default') {Error attempting to save collected ESC data}
java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'BULK_INSERTS'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1030)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:944)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3381)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3482)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3856)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1373)
at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:98)
at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.doBulkInsert(ExternalServiceCallDAO.java:220)
at com.att.retail.r2d2.persistence.dao.ExternalServiceCallDAO.saveExternalServiceCallInfo(ExternalServiceCallDAO.java:138)
Please help my guys out of this. I will really appreciate all suggestions and advices.
Thank you everybody.I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
ORA-06512: at line 12
Here is example for my test procedure:
declare
v_session_id_tab SESSION_ID_TAB_TYPE;
v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
v_status_tab STATUS_TAB_TYPE;
v_notes_tab NOTES_TAB_TYPE;
begin
v_session_id_tab(1) := 1;
v_service_type_tab(1) := 'db';
v_service_location_tab(1) := 'local';
v_service_call_name_tab(1) := 'Name of call';
v_service_call_start_time_tab(1) := SYSDATE;
v_service_call_end_time_tab(1) := SYSDATE;
v_service_call_duration_tab(1) := 100;
v_status_tab(1) := 'Z';
v_notes_tab(1) := 'NOTES';
BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
v_service_call_duration_tab, v_status_tab, v_notes_tab);
end;
I declare all types at schema level.
Please give your comments.
Thank you -
Error when calling a procedure from my apex application
Hello.
I want to create a small APEX application that can configure asynchronous change data capture (distributed hotlog) on certain tables.
Basically, what the application should do is to simply create change tables. Everything else is set up as prerequisite.
My problem is that when I run the following script from schema apex_cdd (using sqldeveloper) , it works; but if I run it from my apex application by calling it when pressing a button as a pl/sql process, it doen't work.
BEGIN
apex_cdc.enable_table_capture
( i_owner => 'staging_cdcpub',
i_change_table_name => 'g_changeTable',
i_change_set_name => 'Source_changeSet',
i_change_source => 'orcl01_cs',
i_source_schema => 'My_src',
i_source_table => 'G',
i_column_type_list => 'STARTDATE DATE,STATUS CHAR(1),NAME VARCHAR2(10),ENDDATE DATE,DESCRIPTION VARCHAR2(255),ID NUMBER(8,0),VALUE NUMBER(10,2)'
END;
If I look in the trace file, i see that the error is:
CDCdebug:in ChangeTable.java enableDisabledTriggers: ORA-06550: line 1, column 8:
PLS-00201: identifier 'SYS.DBMS_CDC_SYS_IPUBLISH' must be declared
ORA-06550: line 1, column 8:
PL/SQL: Statement ignored
oracle.jdbc.driver.OracleSQLException: ORA-06550: line 1, column 8:
PLS-00201: identifier 'SYS.DBMS_CDC_SYS_IPUBLISH' must be declared
ORA-06550: line 1, column 8:
PL/SQL: Statement ignored
Other remarks:
- My procedure calls: sys.DBMS_CDC_PUBLISH.CREATE_CHANGE_TABLE.
- I gave the same rights that I gave for apex_cdc schema to flows_030200 and APEX_PUBLIC_USER schemas (just to see if it works), but it doens't.
Is APEX calling the procedure from another schema ?
Does anyone has an idea why this procedure crashes if called from APEX application, but works ok if called from the same schema APEX application runs on, but using SQLDeveloper ?
Any thoughts are appreciated.
RadianThe procedure apex_cdc.enable_table_capture i created myself with no authid mentioned explicitly, so it uses definer rights, by default.
BUt this procedure is simply a wrapper for sys.dbms_cdc_publish.create_change_table.
When I look on the security model for this sys.dbms_cdc_publish, i see it runs under invoker rights. (http://www.psoug.org/reference/dbms_cdc_publish.html).
The code is like this:
CREATE OR REPLACE PROCEDURE enable_table_capture
i_owner IN VARCHAR2,
i_change_table_name IN VARCHAR2,
i_change_set_name IN VARCHAR2,
i_change_source IN VARCHAR2,
i_source_schema IN VARCHAR2,
i_source_table IN VARCHAR2,
i_column_type_list IN VARCHAR2
IS
BEGIN
EXECUTE IMMEDIATE 'alter session set REMOTE_DEPENDENCIES_MODE=SIGNATURE';
EXECUTE IMMEDIATE 'begin add_log@orcl01(i_tableName => ''G''); end;';
sys.DBMS_CDC_PUBLISH.CREATE_CHANGE_TABLE(
owner => i_owner,
change_table_name => i_change_table_name,
change_set_name => i_change_set_name,
source_schema => i_source_schema,
source_table => i_source_table,
column_type_list => i_column_type_list,
capture_values => 'both',
rs_id => 'y',
row_id => 'n',
user_id => 'n',
timestamp => 'y',
object_id => 'n',
source_colmap => 'n',
target_colmap => 'y',
options_string => NULL);
END enable_table_capture; -
Error while calling stored procedure from apps adapter
Hi,
I am calling Oracle applications standard api to create ar invoice (XX_BPEL_TEST_APPS_ADAPTER_PKG is the name of wrapper package created by adapter) from apps adapter but getting the following error:
Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'test_apps_adapter' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG.AR_INVOICE_API_PUB$CREATE_SIN API. An error occurred while preparing and executing the APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG.AR_INVOICE_API_PUB$CREATE_SIN API. Cause: java.sql.SQLException: ORA-06531: Reference to uninitialized collection ORA-06512: at "APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG", line 199 ORA-06512: at "APPS.XX_BPEL_TEST_APPS_ADAPTER_PKG", line 909 ORA-06512: at line 1 Check to ensure that the API is defined in the database and that the parameters match the signature of the API. This exception is considered not retriable, likely due to a modelling mistake. To classify it as retriable instead add property nonRetriableErrorCodes with value "-6531" to your deployment descriptor (i.e. weblogic-ra.xml). To auto retry a retriable fault set these composite.xml properties for this invoke: jca.retry.interval, jca.retry.count, and jca.retry.backoff. All properties are integers. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
Just wondering if anyone has faced a similar problem?I am trying to pass parameter to test my procedure but it is giving this error : ORA-06531: Reference to uninitialized collection
ORA-06512: at line 12
Here is example for my test procedure:
declare
v_session_id_tab SESSION_ID_TAB_TYPE;
v_service_type_tab SERVICE_TYPE_TAB_TYPE ;
v_service_location_tab SERVICE_LOCATION_TAB_TYPE ;
v_service_call_name_tab SERVICE_CALL_NAME_TAB_TYPE;
v_service_call_start_time_tab SERVICE_CALL_ST_TAB_TYPE;
v_service_call_end_time_tab SERVICE_CALL_ET_TAB_TYPE;
v_service_call_duration_tab SERVICE_CALL_DUR_TAB_TYPE;
v_status_tab STATUS_TAB_TYPE;
v_notes_tab NOTES_TAB_TYPE;
begin
v_session_id_tab(1) := 1;
v_service_type_tab(1) := 'db';
v_service_location_tab(1) := 'local';
v_service_call_name_tab(1) := 'Name of call';
v_service_call_start_time_tab(1) := SYSDATE;
v_service_call_end_time_tab(1) := SYSDATE;
v_service_call_duration_tab(1) := 100;
v_status_tab(1) := 'Z';
v_notes_tab(1) := 'NOTES';
BULK_INSERTS (v_session_id_tab,v_service_type_tab, v_service_location_tab,v_service_call_name_tab,v_service_call_start_time_tab,v_service_call_end_time_tab,
v_service_call_duration_tab, v_status_tab, v_notes_tab);
end;
I declare all types at schema level.
Please give your comments.
Thank you -
Calling stored procedure from session bean method
I have a situation like this :
I have one method on a stateless session bean (and I mark this method as container managed transaction). For database related stuff, I am not using entity beans, I am using my own layer of OR mapping. This method does a lot of stuff and it involves many trips to the database, as a result of which the performance is very poor. I have identified certain pieces of functionality from this method which I think can be moved to stored procedures, while some of the functionality can still remain in the session bean method. So my scenario is like this :
session bean method start
store some data in tables(using my OR layer)
call the stored procedure
session bean method end
My question is :
Will the data that I am storing in tables from within the session bean method, be available to the code executing inside stored proc.
secondly, how do I sync the transcation which is being initiated by the container with the transaction under which the stored proc is executing or is it that the stored procedure code will also be executing under the container managed transcation.
Thanks
VimalHi Vimal,
Will the data that I am storing in tables from within
the session bean method, be available to the code
executing inside stored proc.There's only one way to find out (isn't there?)
secondly, how do I sync the transcation which is
being initiated by the container with the transaction
under which the stored proc is executing or is it
that the stored procedure code will also be executing
under the container managed transcation.Again, why not just "suck it and see!"
[Or is there some reason why you can't?]
As I interpret the EJB specification, if the transaction attribute for your session bean method is such that it starts a transaction, then that transaction will be terminated when the method completes -- and every operation that occurs within the framework of that method will be in the one transaction.
In other words, your database stored procedure should execute within the same transaction as your O/R mapping layer.
However, how OC4J behaves may not exactly follow what is written in the (EJB) specification. Hence I repeat, "try it and see for yourself".
Put it this way: as far as I know, the only way that your stored procedure would NOT see the changes made by your O/R mapping layer is if they both executed in separate transactions and the O/R mapping layer did not commit its changes before the stored procedure began its execution.
Hope this has helped.
Good Luck,
Avi. -
Different session used when calling stored procedure from form
after commiting data in a form to a table, a stored procedure is called that inserts the data written to the table into several other tables. Some columns in the original table are updated - no commit is issued in the procedure. On returning from the procedure the form is re-queried but the updated columns don't contain the updates. This seems to imply that the stored procedure is running as a different session to the one of the form.
Is this the case? Can we make the form and the stored procedure use the same session so that the data is available in both without having to commit in the procedure?No. They should be within one session unless you explicitly open a new session.
The reason why you dont see updates of the data block when you requery is probably the changes on the form never go to the back end. I think first you have to make sure data changes go to db table. You can do a commit_form before calling the stored procedure and open up another session (e.g. sqlplus) to check the data in the table changed or not. -
Getting error when calling stored procedure
I have created 2 stored procedures as follows
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[REAL_PUSH_UPDATE_REPORTS] AS
BEGIN TRANSACTION
DECLARE @cursor_contact_id bigint;
DECLARE cursorContactId Cursor FOR SELECT distinct(contact_id) FROM [dbo].credit_reports WHERE loan_id IS NULL;
OPEN cursorContactId;
Fetch NEXT FROM cursorContactId INTO @cursor_contact_id;
IF(@@FETCH_STATUS <> 0)
PRINT 'There are no LOAN contacts are there with loan ID null, May be you have already executed this procedure'
WHILE(@@FETCH_STATUS =0)
BEGIN
PRINT @cursor_contact_id;
EXECUTE REAL_UPDATE_REPORTS @cursor_contact_id;
Fetch NEXT FROM cursorContactId INTO @cursor_contact_id
END
CLOSE cursorContactId;
DEALLOCATE cursorContactId;
IF (@@Error = 0)
BEGIN
COMMIT TRANSACTION;
END
ELSE
BEGIN
ROLLBACK TRANSACTION;
END
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go
ALTER PROCEDURE [dbo].[REAL_UPDATE_REPORTS] @initial_contact_id bigint AS
BEGIN TRANSACTION
DECLARE @loan_count bigint;
DECLARE cursorLoanID Cursor FOR (SELECT l.loan_id loanIDList FROM (([dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
ON lr.loan_id=l.loan_id
AND lr.contact_id = l.primary_borrower_id)
LEFT OUTER JOIN [dbo].loan_codes lc
ON l.loan_code_id = lc.loan_code_id)
WHERE (l.primary_borrower_id=@initial_contact_id)
AND l.active=1 UNION SELECT l.loan_id
FROM [dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
ON lr.loan_id=l.loan_id LEFT OUTER JOIN [dbo].contacts c
ON c.contact_id =l.primary_borrower_id
WHERE (l.loan_id IN
(SELECT cb.loan_id FROM coborrowers cb where contact_id =@initial_contact_id and active = 1))
UNION
SELECT l.loan_id
FROM [dbo].loans l LEFT OUTER JOIN [dbo].loan_requests lr
ON lr.loan_id=l.loan_id LEFT OUTER JOIN [dbo].contacts c
ON c.contact_id =l.primary_borrower_id
WHERE (l.loan_id IN (SELECT cs.loan_id
FROM cosigners cs where contact_id =@initial_contact_id and active = 1)) UNION
SELECT g.loan_id FROM [dbo].groups g, [dbo].group_members gm,
[dbo].loan_requests lr WHERE gm.group_id = g.group_id
AND lr.loan_id = g.loan_id
AND lr.contact_id = gm.secondary_borrower_id
AND gm.secondary_borrower_id=@initial_contact_id and gm.active = 1)
ORDER BY loanIDList DESC;
OPEN cursorLoanID;
SET @loan_count = @@CURSOR_ROWS;
PRINT @loan_count;
IF(@loan_count > 0) BEGIN
DECLARE @loans_loan_id bigint;
Fetch NEXT FROM cursorLoanID INTO @loans_loan_id;
DECLARE @my_count bigint;
SET @my_count=1;
WHILE(@@FETCH_STATUS =0)
BEGIN
DECLARE @temp_contact_id bigint;
DECLARE @temp_loan_id bigint;
SET @temp_contact_id = @initial_contact_id;
SET @temp_loan_id = @loans_loan_id;
IF(@my_count=@loan_count)
BEGIN
UPDATE [dbo].credit_reports SET loan_id = @temp_loan_id WHERE
loan_id IS NULL AND contact_id = @initial_contact_id
AND NOT EXISTS (SELECT * FROM [dbo].credit_reports
WHERE contact_id = @initial_contact_id AND
loan_id=@temp_loan_id);
END
ELSE
BEGIN
INSERT INTO [dbo].credit_reports(contact_id,credit_bureau_id, credit_score, thirty_days_late,
sixty_days_late, ninety_days_late, currently_negative, amount_past_due,
inquiries_six_mos, public_records, collections, total_accounts_balance,
total_mthly_pymts, report_file, report_gu_id, data_entry_by, data_entry_date,
loan_id) SELECT contact_id,credit_bureau_id, credit_score, thirty_days_late,
sixty_days_late, ninety_days_late, currently_negative, amount_past_due,
inquiries_six_mos, public_records, collections, total_accounts_balance,
total_mthly_pymts, report_file, report_gu_id, data_entry_by,
data_entry_date,@temp_loan_id FROM [dbo].credit_reports WHERE contact_id
= @initial_contact_id AND loan_id IS NULL
AND NOT EXISTS (SELECT * FROM
[dbo].credit_reports WHERE contact_id=@initial_contact_id AND
loan_id=@temp_loan_id);
END
Fetch NEXT FROM cursorLoanID INTO @loans_loan_id;
SET @my_count = @my_count + 1;
END
close cursorLoanID
deallocate cursorLoanID
IF (@@Error = 0)
BEGIN
COMMIT TRANSACTION;
PRINT 'Success for contactID :'+CONVERT(varchar(50),@initial_contact_id);
END
ELSE
BEGIN
ROLLBACK TRANSACTION;
PRINT 'Failed for contactID :'+CONVERT(varchar(50),@initial_contact_id);
END
END
ELSE
BEGIN
ROLLBACK;
PRINT 'NO Loans For the contactID :'+CONVERT(varchar(50),@initial_contact_id);
ENDnow the problem is
i have executed 2 procedures saperately thn its ok while im calling im getting
Msg 16915, Level 16, State 1, Procedure REAL_UPDATE_REPORTS, Line 5
A cursor with the name 'cursorLoanID' already exists.
Msg 16905, Level 16, State 1, Procedure REAL_UPDATE_REPORTS, Line 6
The cursor is already open.Please let me know the reason...
Thank you.
Message was edited by:
User71408What the heck, that's fun..
I for one, have never seen T-sql or whatever it's called.
Looking at it, it seems that a
close cursorLoanID
deallocate cursorLoanID
is missing from the ELSE section doing the rollback.
But, only guessing
Fun, fun, fun -
Issue when calling Stored procedure from application
Dear all,
Oracle DB version: 11.2.0.3
OS : RHEL 5.9 64-bit version
We are trying to execute one of the stored procedure (belonging to oracle DB schema) from our Dotnet application(recites in application server) but it takes more than 30 seconds to fetch the records. The stored procedure is called from application. When we try the same procedure from SQL developer or TOAD it completes within a second. Could anyone suggest on the issue?
Note: we are calling a remote DB view from our DB.
No. of records in the view : 49484929 rows
Thanks in advance,
Imran KhanThanks Billy for the reply. The following is the function of the .net application which calls the procedure:
public DataSet ResourceMonitor(String Date, String DateTime, String starttime, String endtime, String Assstarttime, String Assendtime)
try
cLog.StartMethod(this, System.Reflection.MethodInfo.GetCurrentMethod().Name);
Database dbResourceMonitor = null;
DataSet Resourceset = new DataSet();
dbResourceMonitor = DatabaseFactory.CreateDatabase();
DbCommand dbCommand = dbResourceMonitor.GetStoredProcCommand("SP_RESOURCEMONITOR1");
dbResourceMonitor.AddInParameter(dbCommand, "P_Date", DbType.String, Date);
dbResourceMonitor.AddInParameter(dbCommand, "P_DateTime", DbType.String, DateTime);
dbResourceMonitor.AddInParameter(dbCommand, "P_Starttime", DbType.String, starttime);
dbResourceMonitor.AddInParameter(dbCommand, "P_Endtime", DbType.String, endtime);
dbResourceMonitor.AddInParameter(dbCommand, "P_AssStarttime", DbType.String, Assstarttime);
dbResourceMonitor.AddInParameter(dbCommand, "P_AssEndtime", DbType.String, Assendtime);
//dbCommand.Parameters.Add(BuildRefCursorParameter("DEPRECSET"));
dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET1"));
dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET2"));
dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET3"));
dbCommand.Parameters.Add(BuildRefCursorParameter("RECORDSET4"));
return Resourceset;
catch (Exception ex)
cLog.LogMessages(this, ex.Message, cLog.eWiproMessageTypes.ErrorType);
throw ex;
finally
cLog.EndMethod(this, System.Reflection.MethodInfo.GetCurrentMethod().Name);
The stored procedure SP_RESOURCEMONITOR1 has the following DDL:
CREATE OR REPLACE PROCEDURE SP_RESOURCEMONITOR1
( P_Date IN VARCHAR2,
P_DateTime IN VARCHAR2,
P_Starttime IN VARCHAR2,
P_Endtime IN VARCHAR2,
P_AssStarttime IN VARCHAR2,
P_AssEndtime IN VARCHAR2,
P_Mode IN NUMBER,
RECORDSET1 OUT SYS_REFCURSOR,
RECORDSET2 OUT SYS_REFCURSOR,
RECORDSET3 OUT SYS_REFCURSOR,
RECORDSET4 OUT SYS_REFCURSOR
)AS
BEGIN
OPEN RECORDSET1 FOR
Select ROLEMASTER.ROLEID,ROLEMASTER.ROLENAME as ResourceGroup,departmentmaster.DEPARTMENTNAME,departmentmaster.departmentid from Rolemaster
INNER JOIN departmentmaster ON Rolemaster.DEPTID=departmentmaster.DEPARTMENTID
WHERE 1=1 AND sysdate >=Rolemaster.START_DATE AND sysdate<=Rolemaster.END_DATE AND Upper(RoleMaster.Rolename) not like '%HIGHLOADER%' AND displayinlist=1
ORDER BY ROLENAME;
OPEN RECORDSET2 FOR
select ROM.ROLENAME as ResourceGroup, fn_get_resource_status(p_starttime, p_endtime,RM.Resourceid,RM.DeptID) AS Status,upper(RM.Resourceid)as Resourceid,RM.RoleID,RM.DeptID,TRIM(RM.RESOURCENAME) AS RESOURCENAME,'Detail'As Details,'ResChng'As ResChng,'Calender' As Calender FROM ResourceMaster RM
--INNER JOIN DEPARTMENTMASTER DM ON RM.DEPTID = DM.DEPARTMENTID
INNER JOIN ROLEMASTER ROM ON RM.ROLEID = ROM.ROLEID
where --UPPER (DM.DEPARTMENTNAME) IN ('DISPATCH','TRANSPORT','TRANSPORT RAMP')
RM.DEPTID in (select DEPARTMENTID from DEPARTMENTMASTER where displayinadmin=1 and active=1) ;
if (P_Mode =2) THEN
OPEN RECORDSET3 FOR
select * from mobility_attendance_info_v where TRANSACTIONDATE >= TO_DATE(Substr(p_starttime,1, 9) ,'dd-MON-rr') - 1 order by staffno,TRANSACTIONDATETIME Desc;
END IF;
OPEN RECORDSET4 FOR
select rsa.*,planning.flightno,'' As StTime,SUBSTR(rsa.depdt,11,5) as EndTime from resourceallocation rsa inner join planning ON rsa.planningid = planning.planningid
where TO_TIMESTAMP(rsa.DEPDT,'dd-MON-rr HH24:MI')>=TO_TIMESTAMP(P_DateTime,'dd-MON-rr HH24:MI') ;
END SP_RESOURCEMONITOR1;
The view mobility_attendance_info_v is a called from a remote DB. Hope it's quite clear.
Regards,
Imran Khan -
Invalid Object when Calling Stored Procedure from JDBC Adapter
JDBC Outbound adapter in XI 2.0 connected to SQL Server. I've coded my mapping to format the XSL mapping properly but the Adapter appears to not be able to find the Stored Procedure. Error message returned is "Invalid Object spStoredProcedureName".
Does anybody have any clue as to what I'm missing???I know this is trivial, but did you use the "full" name of the SP as <schema>.<procname>???
HTH -
Calling stored procedure from EJB in JSever
I have some trouble to call stored procedure from EJB deployed to JServer on Oracle8i (815).
I have been able to sucessfully test the stored procedure using thin client JDBC driver. But when I user the default connection in JServer, the stored procedure never got called. Is there any restriction of EJB in JServer?
Thanks
nullThanks man! that was a great help. looks like i am almost there. i created those items t obe hidden.
now i am passing three parameters to the procedure. my url for that column value looks like this,
javascript:P65_PARTITION_ID=#PARTITION_ID#;P65_DBC=#DBC#;P65_FILE_ID=#FILE_ID#;doSubmit('Sku_Save');
the #DBC# parameter is a name of the person that has spaces(firstname lastname). i am getting a javascript error saying,
Line: 1
Char: 37
Error:Expected ';'
i see that char 37 is the space after firstname.
any idea how i should get rid of this error.
Also, as you have been very helpful, a question further beyond :). the above procedure will return a OUT varchar parameter. i guess i have to create another item for that. how do i read it and display just below my report as text.
Thanks Again! -
Operation not found error while calling AM methods from managed bean
Hi,
operation not found error while calling AM methods from managed bean.
written a method with two parameters in AM.
exposed the method in AM client interface
in the page bindings added the method in method action ..left empty in the value fields of the parameters.
calling the method from managed bean like below
String userNameVal = (String)userName.getValue();
String passwordVal = (String)password.getValue();
OperationBinding operationBinding =
ADFUtils.findOperation("verifyLogin");
operationBinding.getParamsMap().put("userName",userNameVal);
operationBinding.getParamsMap().put("password",passwordVal);
operationBinding.execute();
i am getting operation verifyLogin not found error.Please suggest me something to do.
Thanks
SatyaHi vlsn,
Can you try with the below code
// in your backing bean
OperationBinding operation = bindings.getOperationBinding("verifyLogin");
//Put your both parameters here
operation.getParamsMap().put("parameter_name1", parameterValue1);
operation.getParamsMap().put("parameter_name2", parameterValue2);
operation.execute();
if (operation.getResult() != null) {
Boolean result = (Boolean) operation.getResult();
and share the result.
regards,
Rajan -
How to use @jws:sql call Stored Procedure from Workshop
Is there anyone know how to use @jws tag call Sybase stored procedure within
Workshop,
Thanks,Anurag,
Do you know is there any plan to add this feature in future release? and
when?
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
In the current release, we do not support calling stored procedures from a
database control. You will have to write JDBC code in the JWS file to call
stored procedures.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Anurag,
I know how to use DB connection pool and create a db control with it. In
fact, we have created a Web Service with the db control using plain SQL
in
@jws:sql. However, my question here is how to use @jws tag in Weblogic
Workshop to create a Web Services based on Sybase stored procedure orany
Stored Proc not plain SQL.
Thanks,
David
"Anurag Pareek" <[email protected]> wrote in message
news:[email protected]..
David,
You can use a database control to obtain a connection from any JDBC
Connection Pool configured in the config.xml file. The JDBC Connectionpool
could be connecting to any database, the database control is
independent
of
that.
Regards,
Anurag
Workshop Support
"David Yuan" <[email protected]> wrote in message
news:[email protected]..
Is there anyone know how to use @jws tag call Sybase stored
procedure
within
Workshop,
Thanks, -
Array data sporadically lost when calling stored procedure
We have weird problem with stored procedures for which I have not been able to find an explanation so far.
Our app has a bunch of stored procedures which process arrays of integers or strings.
From time to time (maybe 1 in a 1000) array data gets lost when calling stored procedures. From the logs we know that the data gets sent to the stored procedure, but on the DB side the procedure throws an exception because arrays are empty.
We are using (modified) OracleConnectionCacheImp (thus PooledConnections, etc.). My latest guess is that maybe somehow ArrayDescriptors on the (pooled)connection used to call the stored procedure are somehow affected when another pooled connection from OracleConnectionCacheImp gets removed by parallel thread. Is that possible? Or are the PooledConnections internally (in pooled connection data source) completely isolated from each other ?We have weird problem with stored procedures for which I have not been able to find an explanation so far.
Our app has a bunch of stored procedures which process arrays of integers or strings.
From time to time (maybe 1 in a 1000) array data gets lost when calling stored procedures. From the logs we know that the data gets sent to the stored procedure, but on the DB side the procedure throws an exception because arrays are empty.
We are using (modified) OracleConnectionCacheImp (thus PooledConnections, etc.). My latest guess is that maybe somehow ArrayDescriptors on the (pooled)connection used to call the stored procedure are somehow affected when another pooled connection from OracleConnectionCacheImp gets removed by parallel thread. Is that possible? Or are the PooledConnections internally (in pooled connection data source) completely isolated from each other ? -
How to call stored procedure from Pro*C
How to call stored procedure from Pro*C ?
my system spec is SuSE Linux 9.1, gcc version : 3.3.3, oracle : 10g
my Pro*C code is the following..
EXEC SQL EXECUTE
begin
test_procedure();
end;
END-EXEC;
the test_procedure() has a simple update statement. and it works well in SQL Plus consol. but in Pro*C, there is a precompile error.
will anybody help me what is the problem ??I'm in the process of moving C files (with embedded SQL, .PC files) from Unix to Linux. One program I was trying to compile had this piece of code that called an Oracle function (a standalone), which compiled on Unix, but gives errors on Linux:
EXEC SQL EXECUTE
BEGIN
:r_stat := TESTSPEC.WEATHER_CHECK();
END;
END-EXEC;
A call similar to this is in another .PC file which compiled on Linux with no problem. Here is what the ".lis" file had:
Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Jun 12 09:26:08 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Error at line 193, column 5 in file weather_check.pc
193 BEGIN
193 ....1
193 PCC-S-02346, PL/SQL found semantic errors
Error at line 194, column 8 in file weather_check.pc
194 :r_stat := TESTSPEC.WEATHER_CHECK();
194 .......1
194 PLS-S-00000, Statement ignored
Error at line 194, column 18 in file weather_check.pc
194 :r_stat := TESTSPEC.WEATHER_CHECK();
194 .................1
194 PLS-S-00201, identifier 'TESTSPEC.WEATHER_CHECK' must be declared
Pro*C/C++: Release 10.2.0.1.0 - Production on Mon Jun 12 09:26:08 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
System default option values taken from: /oracle_client/product/v10r2/precomp/ad
min/pcscfg.cfg
Error at line 194, column 18 in file weather_check.pc
:r_stat := TESTSPEC.WEATHER_CHECK();
.................1
PLS-S-00201, identifier 'TESTSPEC.WEATHER_CHECK' must be declared
Error at line 194, column 8 in file weather_check.pc
:r_stat := TESTSPEC.WEATHER_CHECK();
.......1
PLS-S-00000, Statement ignored
Semantic error at line 193, column 5, file weather_check.pc:
BEGIN
....1
PCC-S-02346, PL/SQL found semantic errors -
Calling stored procedures from entity object and application module
Hello
I've put in place an EntiyImpl base class containg helper methods to call stored procedures.
I now need to call stored procedures from the application module.
Apart from creating an application module base class and duplicating the helper method code is there a way
to share the helper methods for calling stored procedures between the entity impl and application module impl ?
Regards
PaulDoes the helper code depend on features of a particular entity object instance, beyond its database transaction?
If so, I'm not sure I see how it could be used from an application module class.
If not, here's what you do:
Step 1:
Parametrize the database transaction--you might even want to. So instead of
protected myHelperMethod(Object someParam) {
DBTransaction trans = getDBTransaction();
change this to
protected myHelperMethod(DBTransaction trans, Object someParam) {
Step 2: make the method public and static--once you parameterize the DBTransaction, you should be able to do this.
public static myHelperMethod(DBTransaction trans, Object someParam) {
Step 3: Remove the method from your EntityImpl base class into a utility class:
public abstract class PlSqlUtils {
private PlSqlUtils() {}
public static myHelperMethod(DBTransaction trans, Object someParam) {
When you want to call the method from an application module, entity object, or even view object class, call
PlSqlUtils.myHelperMethod(getDBTransaction(), paramValue);
Unlike Transaction.executeCommand(), this lets you provide functionality like setting procedure parameter values, retrieving OUT parameter values, etc.
Hope this helps,
Avrom
Maybe you are looking for
-
Windows 8.1 - Update consideration, resources, and known issues
This community KB article is being consolidated to help Lenovo customers who are early adopters of the Windows 8.1 update. This article will be frequently updated to include information on recommendation on issues that have been reported and are c
-
Adding a second hard drive for my W520
I'd like to add a second drive for my W520. I need more space to run vmware for demonstrations. I was reading in this article - http://www.storagereview.com/lenovo_thinkpad_w520_upgrade_guide That I could add a second drive by removing the cd drive
-
How to display the data store in Oracle Spatial?
Hello everyone, I am totally newbie in Oracle Spatial and to GIS in general. I have started playing around with Oracle Spatial and did an example which is to store a couple of polygons in Oracle and my question is: how to view/display the stored data
-
Can send exrernal mail but not able to recieve exrernal mail
I have a Mac Mini server that I am setting up DNS, Web, Mail, and Directory services on and am having a problem receiving external mail. I am able to send mail to external email addresses just fine. The bounce back email I get on the external email c
-
Excise value calculation of Assessable Value in Purchase Order
Hi Friends, In a requirement, we need to calculate Excise on Assessable value maintained in J1ID transaction. We are getting excise calculated values on Net value, whereas as per requirement we need to have it on assessable value. Is there any functi