Handling Empty date value in the stored procedure call
Hi,
i am executing a stored procedure having date element, getting below the error for the empty date value.
can any solve this issue?
com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'WD_WRAP_PROCESS_APPMT_REQ_PR' (structure 'STATEMENT'): java.text.ParseException: Unparseable date: ""
Thank You,
Madhav
Madhav,
Can you check if you are sending blank values to the date parameter?
raj
Similar Messages
-
How to pass the parameter values to the stored procedure from java code?
I have a stored procedure written in sqlplus as below:
create procedure spInsertCategory (propertyid number, category varchar2, create_user varchar2, create_date date) AS BEGIN Insert into property (propertyid, category,create_user,create_date) values (propertyid , category, create_user, create_date); END spInsertCategory;
I am trying to insert a new row into the database using the stored procedure.
I have called the above procedure in my java code as below:
CallableStatement sp = null;
sp = conn.prepareCall("{call spInsertCategory(?, ?, ?, ?)}");
How should I pass the values [propertyid, category, create_user, create_date) from java to the stored procedure?[i.e., parameters]
Kindly guide me as I am new to java..Java-Queries wrote:
I have a stored procedure written in sqlplus as below:FYI. sqlplus is a tool from Oracle that provides a user interface to the database. Although it has its own syntax what you posted is actually PL/SQL. -
Who know how to handle pl/sql table return from stored procedure calling from jsp
I have some stored procedure which return pl/sql table (index by table), It is look like an array. how jdbc handle this?
CallableStatement cs = con.prepareCall("EXECUTE bill.getcountry(?,?)");
cs.setInt(1, cid);
cs.registerOutParameter(2, java.sql.Types.VARCHAR);// ARRAY?
ResultSet rs = cs.executeQuery();
Array array = (Array) rs.getObject (1);
ResultSet array_rset = array.getResultSet ();Not that familiar with the OCI (Oracle Call Interface), but I think this call will be problematic - the OCI deals with SQL data types and not with PL/SQL structures.
The OCI has since Oracle 8i sported an object call interface (see OCI Runtime Environment for Objects for details).
This allows you to use the CREATE TYPE command to create advance user data types - and these are supported by the SQL engine, PL/SQL engine and external languages via the OCI.
So you need to have a look at the Perl-DBI documentation to see how it supports Oracle object types and consider using these. As for internal PL/SQL data structures. These are not supported by the SQL engine and I would expect limited or no support in the OCI for these. Anyway, using SQL data types makes a lot more sense ito flexibility and transparency across languages and environments. -
Trying to get a return value from a Stored Procedure
Hi folks,
I have been tasked with something I thought was simple, but apparently its not that simple. I am trying to call a Stored Procedure in UCCX that will do some calculations and returns back an integer value. The stored procedure call I have is:
DECLARE @return_status int
EXEC @return_status = dbo.CTTLoginPhone @CTTId = $EmployeeID , @PIN = $EmployeePIN , @PhoneNumber = $CallingPhoneNumber ;SELECT 'Return_Status' = @return_status
When I run this in this the editor, I get back one row. If I run this in the debugger, I do not get any errors back and the stored procedure runs fine, however the Return_Status is not set either. What am I doing wrong?
I have defined Return_Status with intial value of 0 and the stored proc should be returning back 1 or 2, but the Return_Status remains as 0
Can someone please let me know if I need a DB GET after a DB READ or can I just use the DB READ standalone when calling stored procedure.
All help will be really appreciated.
Thank you.I am having the same issue here... any help would be greatly appreciated. I am on UCCX 8
I am getting 1 row returned when I click "TEST" in the READ step but the DB GET step is going into the SQL Error branch.
Here are some details and I have attached screen shots of my script DB steps.....
I have a Stored Procedure that is very simple...
CREATE PROCEDURE sp_test AS
Select 'N';
GO
Ive created a dummy table with 1 field..
TABLE: testTable
FIELD: code
Let me know if there are any more details I can provide.... -
I've been trying to call a stored procedure through Entity Framework and WCF Data Services (OData). It returns an entity not a complex type. Following walkthroughs found all over the web, I came up with this code inside my service:
[WebGet]
public IQueryable<Entity> GetEntitiesByParameterId(int parameterId)
return CurrentDataSource.GetEntitiesByParameterId(parameterId).AsQueryable();
Calling the proc this way: ~WcfService.svc/GetEntitiesByParameterId?parameterId=1 executes
the stored procedure and returns entities that should be returned. No problem there.
Everything works well until I try to use $select OData option ie. ~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$select=name.
Upon debugging, the method above runs without any error but it returns an Operation could destabilize the runtime error upon reaching the
client. After so much research, apparently it is a very general error pointing to a lot of different causes. I haven't found one that really matches my particular problem. Closest are
http://stackoverflow.com/questions/378895/operation-could-destabilize-the-runtime
https://social.msdn.microsoft.com/Forums/en-US/d2fb4767-dc09-4879-a62a-5b2ce96c4465/for-some-columns-entity-properties-executestorequery-failed-with-error-operation-could?forum=adodotnetdataservices
but none of the solutions worked on my end.
Also, from the second article above:
This is a known limitation of WCF DS. ...
Second is that some of the queries won't work correctly because LINQ to EF needs little different LINQ expressions than LINQ to Objects in some cases. Which is the problem you're seeing.
It has been posted on 2012. If it its true, are there still no updates on this? And is there any other workaround to get the $select working on the stored proc call?
What works:
~WcfService.svc/GetEntitiesByParameterId?parameterId=1
~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$top=1
~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$skip-5
~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$filter={filter query}
~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$expand=SomeNavigationProperty
What doesn't work:
~WcfService.svc/GetEntitiesByParameterId?parameterId=1&$select=name
Tech details:
EntityFramework 5, WCF Data Service 5.0, OData V3
*I've also tried upgrading to EF6 and WCF 5.6.2 and it still didn't work.
Any help would be appreciated. Thanks!Someone from SO replied to my question there and said that $select is still not supported though I couldn't find any definitive documentation about it.
From what I gather and observed, $select breaks the stored procedure call because it tries to alter the data shape already gotten from the database and attempts to return a dynamic entity instead. Something about the stored proc returning an ObjectResult might
be messing it up. As I have said, these are merely my observations.
Workaround: I found a simple and elegant workaround for it though. Since my stored procedures are only getting data from the database and does
not alter data in any way (INSERT, UPDATE, DELETE), I tried using table-valued functions that returns a table equivalent to the entity on my EF. I've found that calling this function on the Service Operation method returns an IQueryable<Entity> which
is basically what is needed. $select also works now and so does other OData query options.
Steps:
Create a function on the database
Update EDMX -> Add function
Add new Function Import with Entity return type
Create service operation in WCF Data Service that calls CurrentDataSource.<FunctionName>()
Test in fiddler.
CODES
Database Function:
CREATE FUNCTION GetEntities(@parameter)
RETURN @entites TABLE(
[Id] [int],
[Name] [nvarchar](100),
AS
BEGIN
INSERT INTO @entities
SELECT [Id], [Name], ... FROM [EntityTable]
RETURN
END
WCF:
[WebGet]
public IQueryable<Entity> GetEntity(int parameter)
return CurrentDataSource.GetEntity(parameter);
It doesn't really solve the stored procedure problem but I'm marking this as answer until someone can provide a better one as it does solve what I'm trying to do.
Hope this helps others too. :) -
Forms Data-Block based on stored procedures - REF CURSOR feature NOT FUNCTIONING
This topic is related to another topic in this forum titled "FORMS HOW TO SET QUERY SOURCE ARGUMENTS??" I posted my message there as well. I am posting as a NEW TOPIC so that it catches the attention of Oracle Support.
I built a data form based on a stored procedure and REF CURSOR IN OUT parameter.
My procedure takes a IN parameter to fill in the criteria for the OPEN <cursor_variable> select ... where ... statement.
In the Value setting of the Query source Arguments , I set the VALUE to ":BLOCK_NAME.ITEM_NAME" at design time to supply the input value to the procedure. this works to the extent of making available the form item value to the stored procedure parameter. I verified this by doing an insert into some debug table , of the incoming parameter value inside my stored procedure.
The cursor gets opened properly into the REF cursor variable. I verified this by fetching a record into a local variable and inserting the value into a debug table again in the stored procedure.
(I took care to close and re-open the REF cursor variable again - so that the front-end can continue to fetch it from the first record. )
***** PROBLEM **************
But the front end forms runtime is giving me a FRM-40301 - query returned no records even though the REF cursor is returned properly opened.
Did anybody else face the same problem ??
Please post what you found.
Thanks,
Shankaran
nullThis topic is discussed at length in another thread "How Set Value For Query DataSource Arguments?"
But I am posting the findings here as well.
THIS TOPIC IS CLOSED.
My Bad. The problem Cause : I did not include all columns in the
cursor rowtype in the Data-block. In the wizard for the data block , I selected ONLY the columns that I needed. But I was doing a Select * from <my_table> in my open cursor <Cursor-Variable> .... The <Cursor Variable>
itself was declared <my_table>%rowtype
FIX : The Data Block structure (columns included as items) should match the cursor record Structure. One may or may not
display all the columns in the LAYOUT though.
But I don't understand why it gives such a misleading message like FRM-40301 Query retrieved no records. Oracle Team fix it.
Hope this helps people who face the same problem.
Thanks, -
Problem when trying the Stored Procedures in JDBC receiver side
Hi,
I am facing some problem when i am trying to configure a scenario in the receiver side of JDBC adpater.
We have never got stored procedures to work as messages go in 'Delivering' status always. It's as if control never gets back to the adapter engine after the stored procedure call is made by the JDBC adapter. Then I went to checkt in the IE where the message has successfuly sent. Then I went to check
in AE where the message is in "Delivering" state for long time.
So checked the Default trace File and Thread dumps.
In Thread dumps, i found a strange thing like one thread is hanging on condition wait at the below location :
at java/lang/StringCoding.getEncoder(StringCoding.java:331(Compiled Code))
at java/lang/StringCoding.encode(StringCoding.java:472(Compiled Code))
at java/lang/String.getBytes(String.java:651(Compiled Code))
at com/sap/aii/adapter/jdbc/SAXHandler.constructResponseStream(xml2sql.java:841(Compiled Code))
at com/sap/aii/adapter/jdbc/SAXHandler.SQLcallStmt(xml2sql.java:988)
Can you please help me in solving this issue as it is very critical to me ?
Thanks,
Prakash.Dear Prakash,
There are number of reasons for SAX error. May be structure is not well defined, statement is not written correctly. These following links help you to solve your issue.
SQL Queries(JDBC sendor CC)
Oracle DB - XI - SQL DB
JDBC Scenerio.
Regards,
JP. -
Stored Procedure call to Oracle - issue
hi ,
I am trying to call a receiver JDBC adapter to call an oracle stored procedure -
I got this error ->
java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call - which I understand is related to mismatch btw the XML and Stored procedure
I checked the XMl and it matches the stored procedure call. I have two specific questions -
1) I have used SAP Note 801367 to have a look at the SQl command sent to the db.. However I do not see the stored procedure in the Audit logs...Does this feature work for Stored procedures too?
2) Can you look at the XML sent to the JDBC adapter...I saw something wierd... even though I had declared the isOutput attribute first and then attribute type... when I loaded the MT into the mapping the order changed...Does than matter?
<customer_id isInput="true" type="VARCHAR">5000123</customer_id>
<product_id isInput="true" type="VARCHAR">0041003</product_id>
<serial_number isInput="true" type="VARCHAR">1</serial_number>
<effective_date isInput="true" type="VARCHAR">2010-03-16</effective_date>
<quantity isInput="true" type="NUMERIC">1.000</quantity>
<currency_code isInput="true" type="VARCHAR">USD</currency_code>
<dist_channel_id isInput="true" type="VARCHAR">11</dist_channel_id>
<division_id isInput="true" type="VARCHAR">04</division_id>
<org_unit_id isInput="true" type="VARCHAR">1005</org_unit_id>
<config_name isInput="true" type="VARCHAR" />
<resolved_price type="NUMERIC" isOutput="true" />
<resolved_currency type="VARCHAR" isOutput="true" />
<contract_id type="VARCHAR" isOutput="true" />
<contract_desc type="VARCHAR" isOutput="true" />
<contract_owner_id type="VARCHAR" isOutput="true" />
<payment_terms type="VARCHAR" isOutput="true" />
<product_group_id type="VARCHAR" isOutput="true" />
<commitment_id type="VARCHAR" isOutput="true" />
<tier_index type="VARCHAR" isOutput="true" />
<shipping_flag type="VARCHAR" isOutput="true" />
<result_code type="VARCHAR" isOutput="true" />
<exec_time type="NUMERIC" isOutput="true" />
java.sql.SQLException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in callArvind,
Just to be sure: are all inputs to yourstored procedure of type varchar, or are there maybe inputs with different types?
A mismatch between the type specified in the XML and the expected inputs of the SP can also cause this error.
Regards,
Koen -
Oracle stored procedure call failed,but not captured by the error handling
Hi All,
I have a unix shelll script which calls a stored proc in Oracle, the stored proc call failed due to "ORA-01033: ORACLE initialization or shutdown in progress".
But it is not captured in the error handling block, Any ideas why this had happened?
SQL file had : my_test_sql.sql
exec my_proc(..............);
Unix shell script has this call:
sqlplus -s my_user/my_pwd@db1 @my_test_sql.sql
if [[ $? -ne 0 ]]; then
echo "failed"
exit 1
else
echo "success"
fi
If i execute the above shell, I'm getting the following
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
SP2-0306: Invalid option.
Usage: CONNÝECT¨ Ýlogon¨ ÝAS SYSDBA¨
where <logon> ::= <username>Ý/<password>¨Ý@<connect_identifier>¨ | /
success.
This puzzled me, any pointers?The $? status variable shows the return code of the last command executed. It will be difficult to determine what the exit status of your sql script is without knowing the script. Do you have any "WHENEVER SQLERROR EXIT" statements in the script?
The ORA-01033 error happens when the database is not open, perhaps in recovery, or startup or shutdown is halted due to a failed or full disk, error in archiving or writing to redo, etc. -
Connection object is getting closed before the stored procedure is complete
Hi Everyone,
I am facing an issue where by the java connection object is closed before the stored procedure it is connected to is complete.
I am not sure if the fault is in SP or Connection pool.
After spending some time, i could able to figure out that the procedure is taking a tad more time for processing as there are over 1000 records in the database tables it is dealing with.
Would that be a potential cause ? or Am i required to handle it in Java only ?
I want to know what could be possible causes for this issue ?
Please Help.
FYI,
The following are the logs which says,
XYZ (Stored Procedure) : Start Time is 1349217771302 Procedure started here
INFO >2012-10-02 18:43:09,935 [ConnectionPool]: Closing connection: DataSource [ABC](684)
INFO >2012-10-02 18:46:03,512 DAO[main]: XYZ : End Time is 1349217963512 Procedure ended here
Thanks in Advance.Hi ,
Thank you all for your quick response.
Well it's my bad i dint provide you any code to look into thinking that i am dealt with a gen issue and also i am too paranoid to post any code i am dealing with in the forum (i am sorry).
But here is some information for you,
Database : Oracle 10g
Java: 1.5 version
We are using only One connection object for the entire java backend process .
The SP is of over 1000 lines of code which for obvious reasons i can't past it here but this morning i figured out an issue in SP where by a query taking way more than usual time to execute which led to SP's poor performance and also the reason for why it is taking very long time than usual.
This query is a simple SELECT query where it is trying fetch over 2000 records from a table of over 3 million records. The execution time is over 30-40 seconds which is the root cause of SP's poor performance.
When i eliminated this from the logic and ran the query it could able process (inserting huge volume around 5000 records of data) in 1 second instead of 3-4 minutes earlier.
I tried to replicate this issue (which occurred in our production server) in my local system but no luck as there was no connection issue here but only the substantial time difference.
We are using a customized connection pool which is as follows,
I am not sure what's going on here because it seems to be greek and latin to me.
What we are doing in our DAO is we are using method of the below ConnectionPool.getInstance(SCHEMA) to get the connection object.
Looking forward to seeking advice from you on how connection pool in general works.
public class ConnectionPool extends Thread
private static final ConnectionPool me = new ConnectionPool();
private Hashtable dataSources = new Hashtable();
private static final int MIN_TIMEOUT = 0;
private long timeOut;
private Hashtable cons = new Hashtable();
private Hashtable active = new Hashtable();
private boolean trace = false;
private ConnectionPool()
registerDataSources();
this.timeOut = PropertyManager.getIntProperty("connectionPool.timeOut", MIN_TIMEOUT);
setName("ConnectionPool");
setPriority(MIN_PRIORITY);
if (timeOut > 0)
start();
private void registerDataSources()
dataSources.clear();
Properties props = System.getProperties();
String app = props.getProperty("X", "Y");
for(Enumeration e = props.keys(); e.hasMoreElements();)
String key = (String) e.nextElement();
if (key.startsWith(app + ".connectionPool.dataSources.") && key.endsWith(".selector"))
String ds = key.substring((app + ".connectionPool.dataSources.").length(), key.length() - ".selector".length());
LogManager.logStatus("Registering [" + ds + "] (selector) " +
props.getProperty(app + ".connectionPool.dataSources." + ds + ".selector"));
dataSources.put(ds,
new GenDataSource(
ds,
props.getProperty(app + ".connectionPool.dataSources." + ds + ".selector")));
continue;
if (!key.startsWith(app + ".connectionPool.dataSources.") || !key.endsWith(".server"))
continue;
String ds = key.substring((app + ".connectionPool.dataSources.").length(), key.length() - ".server".length());
try
LogManager.logStatus("Registering [" + ds + "] " +
props.getProperty(app + ".connectionPool.dataSources." + ds + ".url"));
loadDriver(props.getProperty(app + ".connectionPool.dataSources." + ds + ".driver"));
catch (Exception se)
LogManager.logException(se);
GenDataSource genDataSource = new GenDataSource(
ds,
props.getProperty(app + ".connectionPool.dataSources." + ds + ".useMatrix", "false").equals("true"),
props.getProperty(app + ".connectionPool.dataSources." + ds + ".server"),
props.getProperty(app + ".connectionPool.dataSources." + ds + ".url"),
props.getProperty(app + ".connectionPool.dataSources." + ds + ".user"),
props.getProperty(app + ".connectionPool.dataSources." + ds + ".password"));
// Set the schema if schema is defined in settings.xml file
if (genDataSource != null && props.getProperty(app + ".connectionPool.dataSources." + ds + ".schema") != null ) {
genDataSource.setSchema(props.getProperty(app + ".connectionPool.dataSources." + ds + ".schema"));
dataSources.put(ds, genDataSource);
public static Connection getConnection(String dataSource) throws SQLException
GenDataSource ds = (GenDataSource) me.dataSources.get(dataSource);
if (me.timeOut <= 0)
if (ds.getSchema() != null )
return updateSchema ( ds);
else
return DriverManager.getConnection(ds.url(), ds.user(), ds.password());
String key = dataSource;
Stack free;
GenPooledConnection pc = null;
synchronized (me)
if ((free = (Stack) me.cons.get(key)) == null)
free = new Stack();
me.cons.put(key, free);
if (!free.empty())
pc = (GenPooledConnection) free.pop();
if (pc == null)
if (ds.getSchema() != null )
pc = new GenPooledConnection("DataSource [" + key + "]",
updateSchema ( ds), free, me.active, me.timeOut, me.trace);
else
pc = new GenPooledConnection("DataSource [" + key + "]",
DriverManager.getConnection(ds.url(), ds.user(), ds.password()), free, me.active, me.timeOut, me.trace);
else
pc.touch();
LogManager.logStatus("Using " + pc);
me.active.put(pc.id(), pc);
return pc;
public void run()
for(;;)
try
sleep(60 * 1000);
synchronized (me) {
for(Enumeration e = cons.elements(); e.hasMoreElements();)
Stack stack = (Stack) e.nextElement();
for (int i = stack.size()-1; i >= 0; i--)
GenPooledConnection pc = (GenPooledConnection) stack.elementAt(i);
if (pc.isExpired())
stack.removeElementAt(i);
catch (Exception e)
GenUtil.reportException(e);
private static Connection updateSchema ( GenDataSource ds) throws SQLException {
Connection con = DriverManager.getConnection(ds.url(), ds.user(), ds.password());
if (ds.getSchema() != null ) {
String sql = "SET SCHEMA " + ds.getSchema()+ ";";
LogManager.logDebugMessage("updating the Schema with sql statement " + sql);
PreparedStatement ps = con.prepareStatement(sql);
ps.execute();
ps.close();
return con;
}Thanks.
Edited by: EJP on 5/10/2012 14:09: added {noformat}{noformat} tags. Please use them. -
Getting values from a stored procedure with no parameters
Hi,
I'm trying to get values out of a stored procedure that I created on SQL server. I'm trying to get XML values out of the database, but I'm not sure how to get any data out of it written to a file if the procedure doesn't have any parameters.
So I'm just making a call:
CallableStatement cs = conn.prepareCall("{call myproc}");
cs.execute();How do I get values back from this stage?
Thank you very much,
LiorThe short form answer, which assumes that the stored procedure is returning the XML as an out parameter would go something like this.
public void build(String newUserID, String newPassword) throws SQLException {
String sql = "{ call GET_ITEM_DETAIL(?, ?, ?, ?, ?, ?) }" ;
try{
init(newUserID, newPassword) ;
setCallableStatement(getConnection().prepareCall(sql)) ;
getCallableStatement().setInt(1, getItemNumber()) ;
getCallableStatement().registerOutParameter(2, oracle.jdbc.driver.OracleTypes.CURSOR) ;
getCallableStatement().registerOutParameter(3, oracle.jdbc.driver.OracleTypes.INTEGER) ;
getCallableStatement().registerOutParameter(4, oracle.jdbc.driver.OracleTypes.VARCHAR);
getCallableStatement().registerOutParameter(5, oracle.jdbc.driver.OracleTypes.VARCHAR) ;
getCallableStatement().registerOutParameter(6, oracle.jdbc.driver.OracleTypes.VARCHAR) ;
getCallableStatement().execute() ;
setSqlResult(getCallableStatement().getInt(3)) ;
setSqlMessage(getCallableStatement().getString(4)) ;
if( getSqlResult() != 0 ){
throw new SQLException(getSqlMessage(), null, getSqlResult()) ;
setResultSet((java.sql.ResultSet) getCallableStatement().getObject(2)) ;
if( getResultSet() != null ){
while( getResultSet().next() ){
setItemType(getResultSet().getString("ITEM_TYPE")) ;
setItemValue(getResultSet().getString("ITEM_VAL")) ;
setDisplayType(getCallableStatement().getString(5)) ;
setDisplaySize(Integer.parseInt(getCallableStatement().getString(6))) ;
catch(SQLException e){
java.util.Date now = new java.util.Date() ;
java.text.DateFormat format = java.text.DateFormat.getInstance() ;
setSqlMessage( e.getClass().getName() + " : " + format.format(now) + " : " + e.getMessage() + " : IN " + getClass().getName() ) ;
System.err.println(getSqlMessage()) ;
throw e ;
finally{
closeResources() ;
}The GET_ITEM_DETAIL stored procedure returns several out parameters of various types. The code registers them as out parameters along with an anticipated type and then calls the getXXX(n) method that corresponds with that data type in the appropriate position.
As I mentioned in my other post, the onus of returning the XML is on the stored procedure, when you get it into Java it's going to be a java.lang.String that you can then parse by whatever means is appropriate to your situation.
Regards, -
MULTIPLE VALUES PASSING TO STORED PROCEDURE
Hi,
I have a following stored procedure, I am passing two parameters from the drop down list by using a different dataset. User is selecting multiple values from drop down list in reporting services from
code a drop down and code b drop down.
I have put the JOIN(Parameters!qual_codea.Value,",") in dataset property for both parameters. But it is only displaying first row in the report. In report I have used simple table and Drag Total, Qualification Code A and Qualification Code B in
three columns respectively.
Any Idea why it is not displaying the remaining data for other codes selectedfrom drop down. If i run a query in management studio by using in operation with multiple codes, it display multiple rows which is correct but it is not happening in reporting services.
Any Idea?
ALTER PROCEDURE [dbo].[Multiple_Qualification_Summary]
@qual_codea nvarchar(10),
@qual_codeb nvarchar(10)
AS
select DISTINCT
COUNT(b.PRN) as Total
,A.UKCC_Qualification_Code AS 'Qualification Code A'
,b.UKCC_Qualification_Code as 'Qualification Code B'
from dbo.Practitioner_Register_Part_Status as a, dbo.Practitioner_Register_Part_Status as b, dbo.Qualification_Register_Part as c
where a.PRN = b.PRN
and a.UKCC_Qualification_Code = @qual_codea
and b.UKCC_Qualification_Code = @qual_codeb
AND A.IsLatest = 1 AND B.IsLatest = 1
AND A.UKCC_Qualification_Code = C.UKCC_Qualification_Code
AND C.QUALIFICATION_ACTIVE_SWITCH = 1
group by A.UKCC_Qualification_Code
,b.UKCC_Qualification_Code
order by 1
MHHi Sathya,
Thanks for your reply, do i need to change the stored procedure? According to your link it suggest i have to use XML?
MH
Try this - Passing multi-value parameter in stored procedure
Shahfaisal Muhammed http://shahfaisalmuhammed.blogspot.com -
Customize the stored procedure migrating of MWB
Hi, All,
Is there anybody know how much customize we can have for using
the MWB when migrate stored procedure? For sample I have a SQL
Server 6.5 strored procedure like following:
/******************* SQL Server 6.5 sp *************/
CREATE PROCEDURE sp_SelectUsers
AS
select
tbl_Sp_users.ID, UserName, Password, ExpiresOn,
PwdChangedDate, tbl_Sp_UserGrps.name
from
tbl_Sp_users, tbl_Sp_UserGrps
where
GroupID = tbl_Sp_UserGrps.id
order by username
/******************* end ***************************/
After I migrate it to Oracle 8 with MWB, I got following object,
one Pkg and one Procedure in Oracle db, like following:
/****************** Oracle Pkg **********************/
CREATE OR REPLACE PROCEDURE sp_SelectUsers(
RC1 IN OUT sp_SelectUsersPkg.RCT1)
AS
StoO_selcnt INTEGER;
StoO_error INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
StoO_sqlstatus INTEGER;
BEGIN
OPEN RC1 FOR
SELECT tbl_Sp_users.ID, UserName, Password,
ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
tbl_Sp_users, tbl_Sp_UserGrps
WHERE GroupID = tbl_Sp_UserGrps.id
ORDER BY username ;
END sp_SelectUsers;
/******************* Oracle Procedure ****************/
PROCEDURE sp_SelectUsers(
RC1 IN OUT sp_SelectUsersPkg.RCT1)
AS
StoO_selcnt INTEGER;
StoO_error INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
StoO_sqlstatus INTEGER;
BEGIN
OPEN RC1 FOR
SELECT tbl_Sp_users.ID, UserName, Password,
ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
tbl_Sp_users, tbl_Sp_UserGrps
WHERE GroupID = tbl_Sp_UserGrps.id
ORDER BY username ;
END sp_SelectUsers;
/******************* end *****************************/
As our client use RDO as access method, there is no way we can
use this migrated SP in RDO and return resultset. We need
convert this SP to following to be able to use RDO to get
resultset back in client:
/******************* need convert to *********************/
create or replace package sp_selectUsersPkg
as
cursor c1
is select tbl_Sp_users.ID, UserName, Password,ExpiresOn,
PwdChangedDate, tbl_Sp_UserGrps.name
from tbl_Sp_users, tbl_Sp_UserGrps
where GroupID = tbl_Sp_UserGrps.id
order by username;
type UsersCur
is ref cursor return c1%ROWTYPE;
procedure sp_selectUsers(UserCursor in out UsersCur );
END;
create or replace package body sp_selectUsersPkg
as
procedure sp_selectUsers(UserCursor in out UsersCur )
is
begin
open UserCursor for
select tbl_Sp_users.ID, UserName,
password, ExpiresOn,
PwdChangedDate, tbl_Sp_UserGrps.name
from tbl_Sp_users, tbl_Sp_UserGrps
where GroupID = tbl_Sp_UserGrps.id
order by username;
end;
end;
/******************* end *********************************/
Is there any idea how we can do this? I hope we don't need do
this manually.
Thank you very much for any help!
Jing
nullI have done a rough example of using VB6, RDO and ODBC
drivers, which may be of help to some workbench users:
Calling Oracle 8.1.5 stored procedures with ref cursors using RDO
and Visual
Basic.
Ver 0.1 [email protected]
Summary
Versions Used
Table
Code
With Explicit Ref Cursor Argument
Without Explicit Ref Cursor Argument
Actions
Summary
This gives a comparison of the connectivity between Visual Basic
and Oracle,
with both the intersolve and oracle drivers. The Oracle odbc
still has
significant
shortcomings in comparison to the intersolve/Merant driver.
Versions Used
Visiual Basic 6.0, Oracle odbc driver 8.1.5.3.0, Oracle Database
8.1.5.0.0 on
NT, intersolve/Merant 3.5 32 bit Oracle driver.
Table
html table replaced by rough results in ascii form
test case with named result set cursor variable:
sSQL = "{CALL reftest.GetEmpData(?)}"
oracle 8.1.5.3
could not find item indicated by text, known vb6.0 bug?, thinks
reftest is user
intersolve
could not find item indicated by text, known vb6.0 bug?, thinks
reftest is user
sSQL = "begin reftest.GetEmpData(?); end;"
oracle 8.1.5.3
run time error 40002 driver not capable
intersolve
ok
sSQL = "{CALL GetEmpData(?)}"
oracle 8.1.5.3
run time error 40002 driver not capable
intersolve
could not find item indicated by text,?(similar to bug above?)
at qd.rdoParameters(0).Type = rdTypeVARCHAR
sSQL = "begin GetEmpData(?); end;"
oracle 8.1.5.3
run time error 40002 driver not capable
intersolve
ok
procedure with result set last argument wanting to be simulated
as not
argument result set
strsql = "{CALL BYROYALTYPkg.byroyalty()}"
oracle 8.1.5.3
ok
intersolve
ok
strsql = "begin BYROYALTYPkg.byroyalty(); end;"
oracle 8.1.5.3
wrong number of arguments in byroyalty
intersolve
ok
strsql = "{CALL byroyalty() }"
oracle 8.1.5.3
wrong number of arguments
intersolve
ok
strsql = "begin byroyalty(); end;"
oracle 8.1.5.3
wrong number of arguments
intersolve
ok
Code
With Explicit Ref Cursor Argument
Oracle Stored Procedures and Packages
(on scott/tiger account)
create or replace package reftest as
cursor c1 is select ename from emp;
type empCur is ref cursor return c1%ROWTYPE;
procedure GetEmpData(EmpCursor in out empCur );
END;
create or replace package body reftest as
procedure GetEmpData(EmpCursor in out empCur) is
begin
open EmpCursor for select ename from emp;
end;
end;
create or replace procedure GetEmpData(EmpCursor in out
reftest.empCur)
is
begin
open EmpCursor for select ename from emp;
end;
VB code
Private Sub Command1_Click()
Dim cn As New rdoConnection
Dim qd As rdoQuery
Dim rs As rdoResultset
Dim cl As rdoColumn
Static Number As Integer
Number = 0
cn.Connect = "uid=scott; pwd=tiger; DSN=Oracle;"
'enable the MS Cursor library
cn.CursorDriver = rdUseOdbc
'Make the connection
cn.EstablishConnection rdDriverPrompt
sSQL = "BEGIN GetEmpData(?); END;"
Set qd = cn.CreateQuery("", sSQL)
qd.rdoParameters(0).Type = rdTypeVARCHAR
'Dynamic or Keyset is meaningless here
Set rs = qd.OpenResultset(rdOpenStatic)
'all the output is routed to the debug window
Debug.Print ".....Starting Result Sets....."
Do
Debug.Print
Debug.Print
Do Until rs.EOF
For Each cl In rs.rdoColumns
If IsNull(cl.Value) Then
Debug.Print " "; cl.Name; "NULL"; 'Error
trap for
null fields
Else
Debug.Print " "; cl.Name; " ";
cl.Value;
End If
Next
Debug.Print
rs.MoveNext
Loop
Loop While rs.MoreResults
cn.Close
End Sub
Without Explicit Ref Cursor Argument
Oracle Stored Procedures and Packages
(requires table:
SQL> desc MTG_VERSION
Name
Null?
Type
VERSION
NUMBER
create or replace PACKAGE BYROYALTYPkg AS
TYPE RT1 IS RECORD (
val MTG_VERSION.VERSION%TYPE
TYPE RCT1 IS REF CURSOR RETURN RT1;
PROCEDURE byroyalty(
RC1 IN OUT BYROYALTYPkg.RCT1);
END;
create or replace PACKAGE BODY BYROYALTYPkg AS
PROCEDURE byroyalty(
RC1 IN OUT BYROYALTYPkg.RCT1)
AS
StoO_selcnt INTEGER;
StoO_error INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
StoO_sqlstatus INTEGER;
BEGIN
OPEN RC1 FOR
SELECT VERSION FROM MTG_VERSION;
END byroyalty;
END;
create or replace PROCEDURE byroyalty(
RC1 IN OUT BYROYALTYPkg.RCT1)
AS
StoO_selcnt INTEGER;
StoO_error INTEGER;
StoO_rowcnt INTEGER;
StoO_errmsg VARCHAR2(255);
StoO_sqlstatus INTEGER;
BEGIN
OPEN RC1 FOR
SELECT VERSION FROM MTG_VERSION;
END byroyalty;
VB code
Dim env1 As rdoEnvironment
Dim conn1 As rdoConnection
Dim strsql As String
Dim ps As rdoPreparedStatement
Dim rs As rdoResultset
Private Sub Command1_Click()
strsql = "begin byroyalty(); end;"
'in oracle odbc driver uses refcusor argument to
get result set
Set ps = conn1.CreatePreparedStatement("PsTest",
strsql)
Set rs = ps.OpenResultset(rdOpenStatic)
Text1 = rs!Version
rs.Close
End Sub
Private Sub Form_Load()
rdoEngine.rdoDefaultCursorDriver = rdUseOdbc
Set env1 = rdoEngine.rdoCreateEnvironment(" ", " ", " ")
strsql = "ODBC;DSN=tot4;UID=test;PWD=test;"
Set conn1 = env1.OpenConnection(" ", rdDriverPrompt, False,
strsql)
conn1.QueryTimeout = 3600
End Sub
Actions
Encourage odbc to allow result sets , via the odbc processed
extra
argument, outside of packages.
Document the current situation, and keep users informed of
developments.
Turloch
Oracle Migration Workbench Team
Turloch O'Tierney (guest) wrote:
: Jing,
: Note that there is an example in the FAQ where the intersolve
: driver was used so no change was required in the client code.
The
: intersolve driver optionally converts the extra argument into a
: result set. With the Oracle ODBC driver the argument needs to
be
: explicitly handled.
: Is there a problem with RDO and the 8.0.5 ODBC driver handling
: package references?
: Turloch
: Turloch O'Tierney
: Oracle,
: Migration and Technology Group.
: FAQ entry reproduced:
: How are result sets/dynasets returned to the calling program?
: The Oracle Migration Workbench parser adds an extra
argument
: of type REF CURSOR for result
: sets/dynasets. This type is understood and can be
: manipulated by both PL/SQL and Oracle JDBC. Oracle8
: release 8.0.5 ODBC drivers support REF CURSORs which means
: that the additional argument must be
: explicitly handled by the application, and the client
: application code must be changed. However, some
: third-party vendors such as Intersolv supply ODBC drivers
: for Oracle that support REF CURSORs and can, in
: addition, implicitly make use of REF CURSORs for using
: result sets/dynasets. Therefore, no change is
: required in the client application code. This is
illustrated
: in the following examples of an MS SQL Server
: stored procedure and its equivalent Oracle package and
: stored procedure as generated by the Oracle
: Migration Workbench parser.
: MS SQL Server Stored Procedure
: CREATE PROCEDURE byroyalty
: AS
: select au_id from titleauthor
: GO
: Oracle8i Package and Stored Procedure
: PACKAGE BYROYALTYPkg AS
: TYPE RT1 IS RECORD (
: au_id titleauthor.au_id%TYPE
: TYPE RCT1 IS REF CURSOR RETURN RT1;
: END;
: PROCEDURE byroyalty(
: RC1 IN OUT byroyaltyPkg.RCT1)
: AS
: StoO_selcnt INTEGER;
: StoO_error INTEGER;
: StoO_rowcnt INTEGER;
: StoO_errmsg VARCHAR2(255);
: StoO_sqlstatus INTEGER;
: BEGIN
: OPEN RC1 FOR
: SELECT au_id FROM titleauthor;
: END byroyalty;
: The following example illustrates the typical ODBC code
used
: by Intersolv to call the above MS SQL Server
: stored procedure. This code also works for the above
: Oracle8i package and stored procedure. Note that error
: handling must be added in a real application:
: SQLPrepare(...,'{call byroyalty()}',...)
: SQLExecute()
: SQLBindCol()
: SQLFetch()
: Comments:
: SQLPrepare(...,'{call byroyalty()}',...) is the ODBC SQL
: syntax used to execute stored procedures.
: SQLExecute()executes the stored procedure.
: SQLBindCol()assigns storage for result column 1 in the
: result set (au_id).
: SQLFetch() fetches the first record from the result set
: generated by the stored procedure.
: The following examples illustrate how to call the above MS
: SQL Server stored procedure with result
: sets/dynasets in Visual Basic using DAO and RDO on top of
: ODBC. This code works for Oracle8i packages
: and stored procedures if you use an Intersolv ODBC driver
to
: understand Oracle REF CURSORs.
: DAO
: Private Sub Command2_Click()
: Dim sSql As String
: sSql = "{call byroyalty()}"
: 'In Oracle ODBC driver use refcusor argument to get
: result set
: Set rCustomers = dbsServer.OpenRecordset(sSql,
: dbOpenDynamic)
: Text4 = rCustomers.Fields(0)
: theend:
: End Sub
: Please note, this example assumes that a DAO connection
has
: been set up already.
: RDO
: Private Sub Command1_Click()
: StrSql = "{call byroyalty}"
: 'in oracle odbc driver uses refcusor argument to get
: result set
: Set Ps = connx1.CreatePreparedStatement("PsTest",
: StrSql)
: Set Rs = Ps.OpenResultSet(rdOpenStatic)
: Text3 = Rs!au_id
: Rs.Close
: End Sub
: Please note, this example assumes that an RDO connection
has
: been set up already.
: Jing Zhang (guest) wrote:
: : Hi, All,
: : Is there anybody know how much customize we can have for
using
: : the MWB when migrate stored procedure? For sample I have a
SQL
: : Server 6.5 strored procedure like following:
: : /******************* SQL Server 6.5 sp *************/
: : CREATE PROCEDURE sp_SelectUsers
: : AS
: : select
: : tbl_Sp_users.ID, UserName, Password, ExpiresOn,
: : PwdChangedDate, tbl_Sp_UserGrps.name
: : from
: : tbl_Sp_users, tbl_Sp_UserGrps
: : where
: : GroupID = tbl_Sp_UserGrps.id
: : order by username
: : /******************* end ***************************/
: : After I migrate it to Oracle 8 with MWB, I got following
: object,
: : one Pkg and one Procedure in Oracle db, like following:
: : /****************** Oracle Pkg **********************/
: : CREATE OR REPLACE PROCEDURE sp_SelectUsers(
: : RC1 IN OUT sp_SelectUsersPkg.RCT1)
: : AS
: : StoO_selcnt INTEGER;
: : StoO_error INTEGER;
: : StoO_rowcnt INTEGER;
: : StoO_errmsg VARCHAR2(255);
: : StoO_sqlstatus INTEGER;
: : BEGIN
: : OPEN RC1 FOR
: : SELECT tbl_Sp_users.ID, UserName, Password,
: : ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
: : tbl_Sp_users, tbl_Sp_UserGrps
: : WHERE GroupID = tbl_Sp_UserGrps.id
: : ORDER BY username ;
: : END sp_SelectUsers;
: : /******************* Oracle Procedure ****************/
: : PROCEDURE sp_SelectUsers(
: : RC1 IN OUT sp_SelectUsersPkg.RCT1)
: : AS
: : StoO_selcnt INTEGER;
: : StoO_error INTEGER;
: : StoO_rowcnt INTEGER;
: : StoO_errmsg VARCHAR2(255);
: : StoO_sqlstatus INTEGER;
: : BEGIN
: : OPEN RC1 FOR
: : SELECT tbl_Sp_users.ID, UserName, Password,
: : ExpiresOn, PwdChangedDate, tbl_Sp_UserGrps.name FROM
: : tbl_Sp_users, tbl_Sp_UserGrps
: : WHERE GroupID = tbl_Sp_UserGrps.id
: : ORDER BY username ;
: : END sp_SelectUsers;
: : /******************* end *****************************/
: : As our client use RDO as access method, there is no way we
can
: : use this migrated SP in RDO and return resultset. We need
: : convert this SP to following to be able to use RDO to get
: : resultset back in client:
: : /******************* need convert to *********************/
: : create or replace package sp_selectUsersPkg
: : as
: : cursor c1
: : is select tbl_Sp_users.ID, UserName, Password,ExpiresOn,
: : PwdChangedDate, tbl_Sp_UserGrps.name
: : from tbl_Sp_users, tbl_Sp_UserGrps
: : where GroupID = tbl_Sp_UserGrps.id
: : order by username;
: : type UsersCur
: : is ref cursor return c1%ROWTYPE;
: : procedure sp_selectUsers(UserCursor in out UsersCur );
: : END;
: : create or replace package body sp_selectUsersPkg
: : as
: : procedure sp_selectUsers(UserCursor in out UsersCur )
: : is
: : begin
: : open UserCursor for
: : select tbl_Sp_users.ID, UserName,
: : password, ExpiresOn,
: : PwdChangedDate, tbl_Sp_UserGrps.name
: : from tbl_Sp_users, tbl_Sp_UserGrps
: : where GroupID = tbl_Sp_UserGrps.id
: : order by username;
: : end;
: : end;
: : /******************* end *********************************/
: : Is there any idea how we can do this? I hope we don't need do
: : this manually.
: : Thank you very much for any help!
: : Jing
Oracle Technology Network
http://technet.oracle.com
null -
Data Blocks Based on Stored Procedures
Is it possible to to create a data block based on a stored procedure, and create a dynamic list as a drop down box?
I have a form that runs successfully that has a data block based on a stored procedure. I add my trigger to create and populate the record group. Then in the Property Palette, when I change ITEM TYPE from TEXT ITEM to LIST ITEM, I receive the following runtime error:
FRM-40350: Query caused no records to be retrived.
Note: the tlist/list item runs successfully on a data block based on a table.1) go to the block property to remove the same item column, then re-add the item; Since the property may remember the old text type;
make sure the record value for the list tiem from stored procedure is among the list elements!
Last sort is to do:
2) you may re-create your gui based on the table by setting the list type this time, then set the block property to be based on the stored procedure. -
Forms9i, data block based on stored procedures, refresh on update ?
Hi,
I am using
Forms [32 Bit] Version 9.0.2.9.0 (Production)
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production
Oracle Toolkit Version 9.0.4.0.23 (Production)
PL/SQL Version 9.0.1.3.1 (Production)
Oracle Procedure Builder V9.0.2.0.7 Build #1022 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle Query Builder 9.0.2.0.0 - Production
Oracle Virtual Graphics System Version 9.0.1.5.0 (Production)
Oracle Tools GUI Utilities Version 9.0.4.0.9 (Production)
Oracle Multimedia Version 9.0.4.0.9 (Production)
Oracle Tools Integration Version 9.0.2.0.0 (Production)
Oracle Tools Common Area Version 9.0.1.0.0
Oracle CORE 9.0.1.2.0 ProductionI have a module based on stored procedures. I have defined query, lock and update procedure. All of them are working as they should, I mean that when looking at the input and output from these procedures I don't see anything blatantly wrong.
Now, when I update a table field in the form and call the update stored procedure, this procedure takes the updated values in considerations, updates some more fields, and remove some records.
It is working as it should, except for two details :
1- I don't see the values updated by the procedure in the Form;
2- even though some records were removed from the table by the procedure, I still see all my records.
Is there a way to display the returned table?
And, is there any documentation about data block based on stored procedures, what are the required signatures and limitations of those stored procedures, what a lock procedure is supposed to do (mine does 'null;' ...), how to map a collection type defined in Oracle to a Form data block ? Any link will be appreciated, I have found half a dozen page vaguely detailing this on Google, but nothing that can compare to a usual Oracle manual. Maybe I have missed something.
Thank you for your help.
adsmYes, I was hoping to use these procedures to map the collection type returned to the database to the block data. I guess I was wrong. Except for the initial query and reading some other information from the database, I don't have to use these procedures as I do not write anything to it.
Thank you for your help, I will go on from there.
So, it means that I will have to iterate through my collection inside Forms and manipulate my data row by row. Or, is there a way to pass an Oracle collection type between the database and the Forms client and have it displayed without having to iterate through the rows and mapping each field?
adsm
Maybe you are looking for
-
Cluster - Non-cluster aware application
Hi everyone, I need to migrate some non-cluster aware application from windows server 2003 to windows server 2008 R2 or windows server 2012. On windows server 2003, the cluster service start with a specific domain user to let some access. I have seen
-
SIGCHILD on SQLCODE=100
We experience a large delay (180 Milliseconds)for each time our PRO*COB application executes a FETCH for which there is no data to satisfy the request. If there is data the response to the application is within .1 Milliseconds. After the delay the Se
-
I use iPhoto to share my photos to different sites like facebook and flickr ... with facebook it's easy since the pics don't need much details ... however, I have some trouble with Flickr, since I need to add description, titles and tags for each pic
-
Where i can find the camera sittings in 3gs ios5.0.1
where is the camera sitting in ios 5.0.1 like nightvisin (nightmode) for take pic in low light and how many pixel i use for pic & vides
-
if i wanna make a new account and i have money on the one i have already can i have the amount i have on the one i got put on the new one i wanna make????