Use of java Threads in the stored procedures
Hi good morning all.I have four different requests. Each of them works with a lot of data and manages almost 20 to 40 seconds.
If I was running then one by one, then it would take 80-200 seconds of database and user time.
I know there is a possebility to run queries in sqlj using java market.
I wrote a little application with 4 wires, but when running it I realized that each thread runs one after the other, but not in parallel mode.
Here is the code:
/********************************************************************************************************/
Claire;
create or replace and compile java sources named as dailyReport
Import Java.util;
import java. IO;
import java.sql. *;
Import oracle.sqlj.runtime.Oracle;
Import sqlj.runtime.ExecutionContext;
import java.util.Calendar;
import impossible;
public class dailyReport extends Thread {}
public static final String DATE_FORMAT_NOW = "yyyy-MM-dd hh: mm:";
public static ExecutionContext exec_context = new ExecutionContext();
public static String now() {}
Calendar cal = Calendar.GetInstance ();
SimpleDateFormat sdf = new SimpleDateFormat (DATE_FORMAT_NOW);
Return sdf.format (cal.getTime ());
}
Public Shared Sub runReport (int, String, date1, date2 String sessionID) {}
try {}
System.out.println (dailyReport.Now (). ToString());
View all customers
dailyReport thread1 = new dailyReport();
thread2 = new dailyReport() dailyReport;
dailyReport thread3 = new dailyReport();
thread4 dailyReport = new dailyReport();
System.out.println (dailyReport.Now (). ToString());
start the threads by using the start method)
thread1. Run (1, date1, date2, sessionID);
Thread2.run (2, date1, date2, sessionID);
Thread2.run (3, date1, date2, sessionID);
Thread2.run (4, date1, date2, sessionID);
System.out.println (dailyReport.Now (). ToString());
expect each thread help
the join method)
thread1. Join ();
Thread2.join ();
thread3. Join ();
thread4. Join ();
System.out.println (dailyReport.Now (). ToString());
#sql [exec_context] {commit};
System.out.println (dailyReport.Now (). ToString());
Oracle.Close ();
System.out.println (dailyReport.Now (). ToString());
} catch (SQLException e) {}
System.Err.println ("SQLException" + e);
System.Exit (1);
} catch (Exception e) {}
System.Err.println ("Exception" + e);
System.Exit (1);
}
}
public void run (int x, int sessionID String date1, date2 string) {}
try {}
If (x == 1) {}
{#sql [exec_context]
delete from bx_income where sessionID =: sessionID
};
{#sql [exec_context]
insert into bx_income (field_name, amount, sessionID)
a.Field_Name, abs (sum (amount)) "AMOUNT", select: sessionID
de)
Select b.field_name, l.saldo_vhd_nacval 'AMOUNT. '
of arH_saldo_ls l, bx_setup_acct b
where l.date_oper = to_date(:date1,'yyyymmdd')
and l.licsch like b.accnt |' %'
Union of all the
Select b.field_name, l.saldo_vhd_nacval 'AMOUNT. '
of arH_saldo_ls_fil l, bx_setup_acct b
where l.date_oper = to_date(:date1,'yyyymmdd')
and l.licsch like b.accnt |' %'
) a
A.field_name group
};
} else if (x == 2) {}
{#sql [exec_context]
delete from bx_exchange where sessionID =: sessionID
};
{#sql [exec_context]
insert into bx_exchange (field_name, amount, sessionID)
Select a.field_name, sum (DC) / 1000 'EXCHANGE',: sessionID
de)
Select b.field_name,
(case
When kredit love b.accnt |' %' and debet as 8681% ' then - summa_v_nacval
When debet like b.accnt |' %' and kredit as 6681% ' then summa_v_nacval
end) "DC".
arh_dd d, bx_setup_acct b
where date_oper between to_date(:date1,'yyyymmdd') and to_date(:date2,'yyyymmdd')
and b.foreign_ccy = 1
and)
d.Kredit like 6681% ' or
d.Debet like 8681% '
)
and)
d.Debet like b.accnt |' %' or
d.Kredit like b.accnt |' %'
)
Union of all the
Select b.field_name,
(case
When kredit love b.accnt |' %' and debet as 8681% ' then - summa_v_nacval
When debet like b.accnt |' %' and kredit as 6681% ' then summa_v_nacval
end) "DC".
arh_dd_fil d, bx_setup_acct b
where date_oper between to_date(:date1,'yyyymmdd') and to_date(:date2,'yyyymmdd')
and b.foreign_ccy = 1
and)
d.Debet like 6681% ' or
d.Kredit like 8681% '
)
and)
d.Debet like b.accnt |' %' or
d.Kredit like b.accnt |' %'
)
) a
Group of FieldName
};
} else if (x == 3) {}
{#sql [exec_context]
delete from bx_middle where sessionID =: sessionID
};
{#sql [exec_context]
insert into bx_middle (field_name, db_total, db_foreign, cr_total, cr_foreign, sessionID)
Select field_name, sum (DB_TOTAL) / 1000 'DB_TOTAL', sum (DB_FOREIGN) / 1000 'DB_FOREIGN', sum (CR_TOTAL) / 1000 'CR_TOTAL', sum (CR_FOREIGN) / 1000 'CR_FOREIGN',: sessionID
de)
Select field_name, 'DB_TOTAL' db, db * foreign_ccy 'DB_FOREIGN', 'CR_TOTAL', cr cr * foreign_ccy "CR_FOREIGN".
de)
Select a.field_name,
a.foreign_ccy,
(case
When < 0 then dc *(-1) dc
0 otherwise
end) "DB."
(case
When dc > = 0 then dc
0 otherwise
end) "CR."
de)
Select b.field_name,
b.foreign_ccy,
(case
When kredit love b.accnt |' %' then summa_v_nacval
When debet like b.accnt |' %' then (-1) * summa_v_nacval
end) "DC".
arh_dd d, bx_setup_acct b
where date_oper between to_date(:date1,'yyyymmdd') and to_date(:date2,'yyyymmdd')
and)
Debet not like 8681% ' or
Kredit not like 6681% '
)
and)
d.Debet like b.accnt |' %' or
d.Kredit like b.accnt |' %'
)
Union of all the
Select b.field_name,
b.foreign_ccy,
(case
When kredit love b.accnt |' %' then summa_v_nacval
When debet like b.accnt |' %' then (-1) * summa_v_nacval
end) "DC".
arh_dd_fil d, bx_setup_acct b
where date_oper between to_date(:date1,'yyyymmdd') and to_date(:date2,'yyyymmdd')
and)
Debet not like 8681% ' or
Kredit not like 6681% '
)
and)
d.Debet like b.accnt |' %' or
d.Kredit like b.accnt |' %'
)
) a
) a
) a
Group of FieldName
};
} else if (x == 4) {}
{#sql [exec_context]
delete from bx_outcome where sessionID =: sessionID
};
{#sql [exec_context]
insert into bx_outcome (field_name, amount, sessionID)
a.Field_Name, abs (sum (amount)) "AMOUNT", select: sessionID
de)
Select b.field_name, l.saldo_ish_nacval 'AMOUNT. '
of arH_saldo_ls l, bx_setup_acct b
where l.date_oper = to_date(:date2,'yyyymmdd')
and l.licsch like b.accnt |' %'
Union of all the
Select b.field_name, l.saldo_vhd_nacval 'AMOUNT. '
of arH_saldo_ls_fil l, bx_setup_acct b
where l.date_oper = to_date(:date2,'yyyymmdd')
and l.licsch like b.accnt |' %'
) a
A.field_name group
};
}
} catch (SQLException e) {}
System.Err.println ("SQLException" + e);
System.Exit (1);
} catch (Exception e) {}
System.Err.println ("Exception" + e);
System.Exit (1);
}
}
}
/
create or replace procedure run_Daily_Report (x number, String, name of file in string DirName)
is the language java name 'dailyReport.runReport (int, java.lang.String, java.lang.String);
/
/********************************************************************************************************/
Maybe I shouldn't run threads with the thread < N > .run but with thread < N > m:System.NET.HttpListener.start.
Please help me to reslove this problem.
Best regards.
Murad balde.
user11221084 wrote:
I wrote a little application with 4 wires, but when running it I realized that each thread runs one after the other, but not in parallel mode.
Which is the expected behavior, because Oracle JVM uses a running thread model.
Tags: Database
Similar Questions
-
Passing an array as a parameter of java (java controls) for the stored procedure
Hello
I use java controls (BEA Weblogic Workshop 8.1) to call a stored procedure and send an array as a parameter to the stored procedure of java. The following code throws an exception 'Fail to convert the internal representation.
Java code
import com.bea.control.DatabaseControl.SQLParameter;
Here I create the java
int [] = {12,13,14} javaArray.
The code below is used to create the table from sql to oracle for the procedure
SQLParameter [] params = new SQLParameter [1];
Object obj0 = javaArray;
params [0] = new SQLParameter (obj0, oracle.jdbc.OracleTypes.ARRAY, SQLParameter.IN);
the code below calls the myFunc in file OJDBCtrl.jcx
String success = dbControl.testFunc (params);
OJDBCtrl.jcx
/**
* @jc: = sql statement ' call CMNT_TST_PROC (?)).
*/
String Myfunc (SQLParameter [] param);
The stored procedure that is used:
SL_tab IS NUMBER TABLE INDEX BY PLS_INTEGER;
Procedure cmnt_tst_proc (cmnt_tst sl_tab);
Procedure cmnt_tst_proc (cmnt_tst sl_tab) is
BEGIN
dbms_output.put_line ('Hello');
END;
I'm getting the following exception
Failure = Java.Sql.SqlException: Internal failure to convert the representation: [I@438af4 [ServiceException] >]
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:861)
at oracle.sql.ARRAY.toARRAY(ARRAY.java:210)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7768)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7449)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7837)
at oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4587)
at weblogic.jdbc.wrapper.PreparedStatement.setObject(PreparedStatement.java:244)
at com.bea.wlw.runtime.core.control.DatabaseControlImpl._setParameter(DatabaseControlImpl.jcs:1886)
at com.bea.wlw.runtime.core.control.DatabaseControlImpl.getStatement_v2(DatabaseControlImpl.jcs:1732)
at com.bea.wlw.runtime.core.control.DatabaseControlImpl.invoke(DatabaseControlImpl.jcs:2591)
at com.bea.wlw.runtime.core.dispatcher.DispMethod.invoke(DispMethod.java:377)
at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:433)
at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:406)
at com.bea.wlw.runtime.core.container.Invocable.invoke(Invocable.java:249)
at com.bea.wlw.runtime.jcs.container.JcsContainer.invoke(JcsContainer.java:85)
at com.bea.wlw.runtime.core.bean.BaseContainerBean.invokeBase(BaseContainerBean.java:224)
at com.bea.wlw.runtime.core.bean.SLSBContainerBean.invoke(SLSBContainerBean.java:109)
at com.bea.wlwgen.StatelessContainer_ly05hg_ELOImpl.invoke(StatelessContainer_ly05hg_ELOImpl.java:153)
...
Can you please let me know, what am I doing wrong and how can I pass an array to a procedure/function using java controls.
Any help will be much appreciated.
Published by: user12671762 on February 24, 2010 05:03
Published by: user9211663 on February 24, 2010 21:04Try using an oracle.sql.ARRAY with a nested table or varray instead of a table index. Create the type SQL and Java object as follows
SQL> create type sl_tab as varray(3) of integer; Java: ArrayDescriptor ad = ArrayDescriptor.createDescriptor ("
.SL_TAB", java.sql.Connection); Object elements = new Object[3]; elements[0] = new Integer(12); elements[1] = new Integer(13); elements[2] = new Integer(14); oracle.sql.ARRAY array = new oracle.sql.ARRAY(ad, oracle.jdbc.OracleTypes.ARRAY, elements); SQLParameter[] params = new SQLParameter[1]; params[0] = new SQLParameter(array, oracle.jdbc.OracleTypes.ARRAY, SQLParameter.IN); String succ = dbControl.testFunc(params); I don't think that you can pass an array of Java, this is why you have more success using an oracle.sql.ARRAY with a SQL varray. -Michael-
-
How to use a button to fire the stored procedure or anonymous block PLSQL
I am converting an application forms at the APEX, and which was easy became almost unbelievably difficult. I have a page that represents a record with an element called "history_rec". It is an element of the checkbox. Clicking on it causes the column for this record to be filled with the letter 'H', indicating that this recording is now historical and not assets. I also have this page a button that says "Renew Record." This button redirects to the current page and sets the value of 5 elements of the page on the values of the record being replaced with the new record.
(This, incidentally, is an insurance system of follow-up to the loan guarantees. The insurance must be renewed annually, and this system is used to ensure that it is.)
I also want the button to trigger a process that updates the old record by filling in the history_rec column. To do this, I created a process called "make_history" that contains the following SQL code:
"Ensure the update
Set history_rec = "H".
"where insureseq =: P22_INSURESEQ.
I chose for the 'process' Point ' on demand: run this process when requested by AJAX. "
Is it possible my button 'Renew the Record' and if so, how? If this is not the case, how should I proceed?Doug,
I'm glad you've made any progress.
What process throws the error, it is the last process?
"Error Unable to fetch row ' with this code ORA" ORA-01403: no data found. "
Is page 21 page that you develop?
I want to make is that demand for return on page 21
What you already have for the branches Page?
Jeff
-
Hello
I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...
HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport "
... ");resCode = DBExecutePreparedSQL (hstmt);
resCode = DBClosePreparedSQL (hstmt);
... but in this case, I am not able to read the return value of the stored procedure.
I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?
No idea how to solve my problem?
Cake of KR
DianaS salvation,
Thanks for your comments. During this time I found another way which fullfill my needs:
resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);
sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)
{
/ * Enter values in the record. */
resCode = DBGetColInt (hstmt, 1, & s32_TestId);
}resCode = DBDeactivateSQL (hstmt);
sz_Buffer is the content of the XML file.
Cake of KR
-
user_table should be used in the stored procedure.
Hello
I want to find my permanent table user_tables and then drop and recreate it,
I can use this user_tables in my stored procedure for above purpose or is there any notice that must be used.
SP is admin sp, used to run in offline mode.
yorus truly
Published by: 944768 on 10 February 2013 23:44
Published by: 944768 on 10 February 2013 23:44944768 wrote:
but I wanted to know that can I use user_table in above proc stored to conclude and then drop and create it when Everitt runs?Oracle manages two "flavors" of the stored procedure - copyright and rights of the Summoner. Rights of the DEFINER (default) is always performed under stored security area of the owner of the procedure no matter who calls it. So, if you ask USER_TABLES (or any display USER_, besides) within DEFINER rights stored procedure, you will get a list of tables owned by the owner of the stored procedure, not stored calling procedure. Rights (AUTHID CURRENT_USER) stored Invoker procedure is always carried out under the domain of the calller security. Therefore, if you are querying USER_TABLES (or any display USER_, besides) within the Summoner rights stored procedure you will get a list of tables belonging to the appellant a stored procedure. Hope it answers your question.
SY.
-
Use the stored procedure to create the data model for the bi publisher report
Hi all
Can we use stored procedure to create the data model for BI Publisher reports? I did find an example by using the stored procedure to complete the data model in the bi publisher report.
Thank you
ViratCheck out these links
BI publisher to use the stored procedure
Re: Stored procedures and dynamic columns
Re: Is it possible to use stored procedures in BI Publisher GUI?
Re: PL/SQL stored w / model XML?If brand pls help
-
We use the procedure attached to within an ASP application obfuscation of the password database. I am able to use the same procedure in CF without modification? Right now, I have tried with cfstoredproc but'm "Procedure 'dt_External_Encrypt' expects parameter '@Encrypted', which was not supplied."
You do not use the ODBC driver.
Most likely, there is a typing error in the code or the stored procedure is not also displayed (or a copy).
Change procedure = "dt_External_Encrypt" to procedure = "dbo.dt_External_Encrypt" "
Open Query Analyzer, 'Edit' code stored procedure and make sure that it is really such displayed.
Finally, try changing returnCode 'no '.
If all else fails, join the code exact CF code and code from Query Analyzer.
-
can I export and import my database to oracle via the stored procedure?
Hi all
I need to export my database using the stored procedure, the stored procedure is called by the java application and it works well
Now I still get the "ULTIMATE QUESTION", could export and import the database using the stored procedure?
Really thanks for the reply.
Kind regards
KahlilHello
I think you can use DBMS_DATAPUMP (10.1 +), see [DBMS_DATAPUMP | http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/d_datpmp.htm#i1007277], for examples, see [http://www.psoug.org/reference/dbms_datapump.html]
Kind regards
-
Call the stored procedure, and bind parameters by name
Hello
I use the Oracle ODBC 12 c driver to pass values from one Interface to our database Oracle 11.2. The Interface software collects data from modbus protocoll and calls a stored procedure. Right now my syntax to call the stored procedure looks like this:
CALL procedure-name ('STRING', 'Timestamp as String', numValue1);
It works very well. Now, I have to add a default setting to my procedure. To stay flexible to make other changes, I want to call the procedure and bind the parameters by name. Release 10.2.0.1.0 ISC ODBC Notes:
Added support for the named parameter, binding the parameters by name. ODBC Oracle driver now allows the application to specify the parameters of a stored procedure by name, in the procedure call. Named parameters are to be used in calls to stored procedures and should not be used in other SQL statements.
So, it shouldn't be a problem to use named notation, but how do I do this in ODBC? I tried like this, but oracle returns an ora-00936 error of missing expression:
call procedure-name (paramName1 = > 'STRING',= paramName2 > 'Timestamp as String',paramName3 = > numValue1).
Thank you for your help.
Finally, I was able to find the error. The syntax of the statement was very good. The problem was caused by another declaration that I edited before and the error has not attracted Attention immediately.
Thanks for reading and looking for an answer.
-
Block based on the stored procedure cannot modify Default_where clause
Hi all
I tried to create a block based on the stored procedure that it works very well with the result set for the refcursor. But if I need to add filters on the block using where clause in the palette of goods or
using the property block set in where clause, it does not error but does not review filters .
tried everything to you please let me know. This is a restriction whereby we can set filters on the block when we create the block based on the stored procedure.
Thank you
Check in Form Builder Help:
Creating a block of data from a procedure that uses a ref cursor
... You can't pass a WHERE or ORDER BY clause clause in a stored procedure.
But you can send your WHERE condition using the query Source Arguments.
If the procedure is on the side of the database (not in the forms module), ensure that the procedure is not vulnerable to injection of SQL code.
Kind regards
Zlatko
-
Execution of the stored procedure Oracle EF6 error.
Hello
Need help with the oracle error
{"ORA-06550: line 1, column 8:"}
PLS-00306: wrong number or types of arguments in the call to "sp_name".
ORA-06550: line 1, column 8:
{"PL/SQL: statement ignored '}
This error occurs when the code runs the line in Vb.net application in Model Designer
MyBase.ExecuteFunction ("sp_name" para1, para2, para3, dOBpara4, para5)
I create the SSDL and CSDL, MSL files for oracle to MS SQL connection by the method mentioned in the link JasonShort - professional profile - CodeProject it worked perfectly fine without the stored procedures. I managed to insert, update, and delete records. Then, I created stored procedures for Insert, Update, Delete. It worked fine with MS SQL. I copied and updated oracle files respectively. I gives me the error mentioned above.
I executed stored procedures in Oracle SQL Developer, and it works without error. But when it is executed via the model there is light of the error. Can anyone let me know the solution for this error. I'm using VS2010, EF6, Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
Thank you
Prachin Soparkar
Hello
Sorry for the inconvenience. After I posted this question I took a break and saw that the error was nothing, but I had given FNAME as parameter name in MS SQL. In oracle when I created the sp I created the parameter with p_FNAME. Where the schema defined in the language SSDL and CSDL, MSL had to be changed to MS, but since I want to that it would be same in different databases, I choose to have changed it in oracle stored procedure. The error msg is confusing, it should be something not found parameter or incompatibility etc.
Thank you
Prachin Soparkar
-
Materialized view, based on the stored procedure
Hi all
is it possible to create a materialized view on the results returned by a stored procedure?
If this is not the case, do you think that any other way except for filling a table with data from the stored procedure and then founded the MV on it?
Thanks in advance.
MichaelTsilikidis wrote:
Sorry I don't speak properly. In fact the procedure does not return a value, it fills one of its parameters (of the ref cursor type) of data. That's what I wanted.
No it's not.
REF CURSOR don't store data, so it's not possible.
A Ref cursor is just a pointer to a query... and you can't "select from" a ref cursor, you can retrieve only one open.
PL/SQL 101: Understand the Ref Cursor
As correctly stated above, you can't question from a procedure to a function, and a materialized view is based on a query, you cannot use a procedure in a materialized view.
You could use a function pipeline instead of a procedure, or have the pipeline function obtain the results of the procedure and pipelines, and then the materialized view could be based on the results of this function in the pipeline.
example of function pipeline:
SQL > CREATE or REPLACE TYPE AS OBJECT num_descript (num number, descript varchar2 (30))
2.Type of creation.
SQL >
SQL > CREATE or REPLACE TYPE tbl_num_descript AS TABLE OF THE num_descript
2.Type of creation.
SQL >
SQL >
SQL > CREATE or REPLACE PACKAGE AS-reftest
2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED;
3 END;
4.Package created.
SQL >
SQL > CREATE or REPLACE PACKAGE BODY AS-reftest
2 FUNCTION pipedata (number p_choice) tbl_num_descript RETURN PIPELINED IS
3 v_obj num_descript: = num_descript (NULL, NULL);
4 v_rc sys_refcursor;
5 BEGIN
6. IF p_choice = 1 THEN
7 v_rc OPEN to SELECT empno as num, ename like descript FROM emp;
8 ELSIF p_choice = 2 THEN
9 OPEN v_rc to SELECT deptno as num, dname as descript OF THE Department;
10 END IF;
11 LOOP
12 FETCH v_rc INTO v_obj.num, v_obj.descript;
EXIT 13 WHEN v_rc % NOTFOUND;
14 PIPE ROW (v_obj);
15 END LOOP;
16 v_rc NARROW;
RETURN 17;
18 END;
END 19;
20.Package body created.
SQL > select * from table (reftest.pipedata (1));
DESCRIPT NUM
---------- ------------------------------
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
KING 7839
7844 TURNER
7876 ADAMS
JAMES 7900
7902 FORD
7934 MILLER14 selected lines.
SQL > select * from table (reftest.pipedata (2));
DESCRIPT NUM
---------- ------------------------------
10 ACCOUNTING
SEARCH 20
30 SALES
40 OPERATIONS -
Error on the definition of the stored procedure in the simultaneous program
Hello
I created a stored procedure and wanted it attached to the concurrent program. The purpose of this stored procedure when you run it in simultaneous program, the system retrieves the data from the csv file downloaded from the server, then it will insert in the tables of SO / the Interface API. Below, the error occurred.
* Starts * 18 April 2012 18:18:42
Error ORACLE 6550 in FDPSTP
Cause: FDPSTP failed due to the ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in the call to 'SPKO1 '.
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Steps I did to set the stored proc
< < simultaneous executable program > >
Executable: RDRAGON_SO_IMPORT
Short name: RDRAGON_SO_IMPORT
Application: Order management
Method of execution: PL/SQL, stored procedure
Run file name: SPKO1
< < concurrent program - set > >
Program: RDRAGON SO IMPORT
Short name: RDRAGON_SO_IMPORT
Application: Order management
Name of executable: RDRAGON_SO_IMPORT
Method: PL/SQL, stored procedure
Format: text
No set
-Here are my stored procedure-
CREATE OR REPLACE PROCEDURE APPS. SPKO1 IS
FH UTL_FILE. TYPE_DE_FICHIER;
v_line VARCHAR2 (32767).
v_source_id NUMBER (10);
v_created_by NUMBER (10);
v_creation_date DATE;
v_org_id NUMBER (10);
v_orig_sys_docref VARCHAR2 (50);
V_Customer VARCHAR2 (360);
v_customer_prev VARCHAR2 (360);
v_sold_to_org NUMBER (10);
v_orig_line_ref NUMBER (10);
v_item_code VARCHAR2 (2000);
v_ordered_qty NUMBER (10);
v_selling_price NUMBER (10);
v_count NUMBER (10);
v_stat NUMBER;
/******************************************************************************
NAME: SPKO
PURPOSE:
REVISIONS:
Worm Date Description of the author
--------- ---------- --------------- ------------------------------------
1.0 16/04/2012 administrator 1. Created this procedure.
NOTES:
Keywords to replace automatically available Auto:
Object name: SPKO
SYSDATE: 16/04/2012
Date and time: 16/04/2012, 17:55:42 and 16/04/2012 17:55:42
Username: admin (set in Options of TOAD, editor of the procedure)
Name of the table: (defined in the dialog box "New PL/SQL object")
******************************************************************************/
BEGIN
v_source_id: = 6;
v_created_by: = - 1;
v_org_id: = 204;
v_customer_prev: = null;
v_orig_line_ref: = 0;
v_stat: = 0;
SELECT header_id in (DE) v_orig_sys_docref
Select header_id
of OE_ORDER_HEADERS_ALL
creation_date desc order
) WHERE ROWNUM = 1;
FH: = UTL_FILE. FOPEN ('XXANDDIR2', 'myfile1.csv', 'R', 32767);
< < file_read_lines > >
LOOP
BEGIN
UTL_FILE. GET_LINE (fh, v_line);
V_Customer: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 1") ',' "') ','" ');
v_creation_date: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 2") ',' "') ','" ');
v_item_code: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 3") ',' "') ','" ');
v_ordered_qty: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 4") ',' "') ','" ');
v_selling_price: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 5") ',' "') ','" ');
v_orig_line_ref: = (v_orig_line_ref + 1);
If v_stat = 0 then
v_orig_sys_docref: = (v_orig_sys_docref + 1);
end if;
SELECT hca.cust_account_id from v_sold_to_org
OF hz_cust_accounts AOB.
HP hz_parties
WHERE hca.party_id = hp.party_id
AND hca.request_id is null
AND hp.party_name = v_customer;
If v_stat = 0 then
INSERT INTO OE_HEADERS_IFACE_ALL)
order_source_id,
orig_sys_document_ref,
org_id,
CREATION_DATE,
created_by,
last_update_date,
last_updated_by,
operation_code,
sold_to_org_id,
booked_flag)
VALUES)
v_source_id,
('TEST' | v_orig_sys_docref).
v_org_id,
v_creation_date,
v_created_by,
v_creation_date,
v_created_by,
"INSERT."
v_sold_to_org,
'Y') ;
commit;
end if;
INSERT INTO OE_LINES_IFACE_ALL)
order_source_id,
orig_sys_document_ref,
orig_sys_line_ref,
inventory_item,
org_id,
ordered_quantity,
unit_selling_price,
unit_list_price,
CREATION_DATE,
created_by,
last_update_date,
last_updated_by,
operation_code)
VALUES)
v_source_id,
('TEST' | v_orig_sys_docref).
v_orig_line_ref,
v_item_code,
v_org_id,
v_ordered_qty,
v_selling_price,
v_selling_price,
v_creation_date,
v_created_by,
v_creation_date,
v_created_by,
"INSERT");
commit;
v_customer_prev: = v_customer;
If v_customer_prev = v_customer then
v_stat: = 1;
on the other
v_stat: = 0;
end if;
-DBMS_OUTPUT. Put_line ('Col1: ' | v_source_id |', Col2: ' | v_creation_date |', Col3: ' | v_created_by |', Col4: ' | v_updated_date |', Col5: ' | v_updated_by);
EXCEPTION
WHEN NO_DATA_FOUND THEN
OUTPUT file_read_lines;
END;
END LOOP;
SELECT count (*) in the OE_HEADERS_IFACE_ALL v_count;
DBMS_OUTPUT. Put_line (' record Total inserted successfully: ' | v_count);
UTL_FILE. FCLOSE (FH);
END SPKO1;
/
But when I run the stored procedure using TOAD his work.
Help, please. This is my first time to attach the stored procedure in the concurrent program.
Thank you very much.
Kind regards
Diane
Published by: peopsquik08 on April 18, 2012 03:58as clive_t solier
>
You must explicitly reference the settings out
>Try
DECLARE VFILE VARCHAR2(32767); V_SOURCE_ID NUMBER; -- ERRBUF VARCHAR2(200); RETCODE NUMBER; BEGIN VFILE := 'myfile1.csv'; V_SOURCE_ID := 6; --APPS.OMORDERLOADER.SPKO1 ( VFILE, V_SOURCE_ID ); --COMMIT; APPS.OMORDERLOADER.SPKO1( ERRBUF => ERRBUF, RETCODE => RETCODE, VFILE => VFILE, V_SOURCE_ID => V_SOURCE_ID ); END;
but the code above to test your proc
to run concurrent SQL, you can use fnd_submit.submit_program
-
Maximum number of parameters sent to the stored procedure
I have a web form where I insert data in Oracle. There are at least 20 fields on the form. For the INSERT, I want to use the stored procedure. But in this case for the section of the VALUES in the INSERT statement, I need to send that many - in this case 20 settings. Is it normal for a procedure to receive 20 parameters? If this isn't the case, then should how I follow to do? I know that technically there is only no problem but isn't normal programming or database managementwise? I think it's the basic thing any developer web do it all the time.Is it normal for a procedure to receive 20 parameters?
Sure. It is very good.
But what is normal programming or database managementwise
If you need to insert values for 20 fields then normal.
-
Need help, run the stored procedure in ASP.
I have a web page in which I would use a query like http://ereply.us/q/l.asp?id=383966476 string
It directs the user to a page that contains the following code:
<!-queue = "database_connection.asp #include" - > "
< %
If not isempty (request.querystring ("id")) then
SQL = "exec dbo.fp_qr_code @sequence (request.querystring ("id")) =" "
If rs.state = 1 then rs.close
RS. Open sql, conn, 3, 2
If rs.recordcount <>0 then
session("Name") = rs ("name")
session("JobID") = rs ("jobid")
session("SEQ") = rs ("seq")
If rs ("id") <>"" then the answer. " Redirect ("index.asp")
end if
end if
% >It queries a SQL database to return the value of 'name '. In turn, according to the code of the user should be directed to 'Index.asp' that contains:
Welcome < % response.write (session("name")) % >
And the page you should see the page with"Welcome". Instead, I get a server 500 error. The stored procedure runs as a stand-alone query in SQL Management Studio.
Any ideas would be greatly appreciated.
I solved this. This is the query that worked:
< %="">< br="">SQL = "" exec fp_qr_code ' "& request.querystring ("id") &" ' " < br=""> set rs = Conn.Execute (sql) < br=""> if rs.eof then response.write ("no registration") < br=""> while not rs.eof" ""
response.write (("name") rs)response.write (("imgname") rs)
response.write (rs ('url'))
RS.MoveNext
Wend < br=""> %>
Maybe you are looking for
-
Satellite L650 does support internal fax modem?
have a new satellite l650. can someone tell me if it has an internal fax modem or do I have to buy an external one.I'm in a rural area so that nobody seems to know.
-
First - Division of polynomial
Quick questions, hoping someone can explain. I want to do first HP (2 x ^ 2 + x + 6) /(x+1) When I enter quot(2x^2+x+6,x+1) I get 2 x-1, but he neglects to tell me about the rest of (7 / x + 1) is this nbehaviour expected? How can I get a complete re
-
Computer HP laptop will not stay in fullscreen
When watching a video on youtube (not just youtube) and I put it in full screen about three minutes later it goes back to normal size unless I have just continues to move the mouse. It does this with Firefox, Chrome, etc.
-
I have a laptop with the finger scan, but I forgot my admin password.
I have read many questions about lost passwords, BUT I am able to log on with the finger scan. I can't remember the actual password. I want to change it of course. I can't launch that the password reset utility because that it ask for the password. I
-
Problems with the last update CC.
Updated my ID and PS and neither works now. I had to go back to the CS6 and just to get the completed files. I pay the monthly fee for software that do not work. Have uninstalled, restarted, yadayadayada without success. Now I'm afraid to do the up