How to retrieve the outer parameter of a stored procedure in XSQL page
I have to call a stored procedure in the xsql page that returns a resultset (ie. oracle table/record type) through an outer paramter. Is there any built-in xsql action tag available to get the parameter and present
it in xml on the page? please help, thanks.
You cant get two resultsets out of SP like this. The workaround is to merge and bring the resultsets.
For this number of columns as well as corresponding datatypes have to be compatible. Also you will need one additional column which indicates resultset value. Then use this as filter to get your desired resultset out
create procedure GetData as
begin
select 'resultset1' as Cat,*,.. N columns from Emp
union all
select 'resultset2' as Cat,*,.. N columns from Dept
end
create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
Insert into #tmp1 (Ddeptid , deptname ,Location )
Select column1,column2,column3
from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
Integrated Security=SSPI','Execute yourdb..GetData')
WHERE Cat = 'resultset1'
create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
Insert into #tmp (empId,ename,deptId,salary)
Select column1,column2,column3, column4
from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
Integrated Security=SSPI','Execute yourdb..GetData')
WHERE Cat = 'resultset2'
also see
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
Another method is to populate table with relevant resultset within procedure itself and then select from the table directly outside.
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page
Similar Messages
-
How do i handle out parameter from a stored procedure in a vb form?
hi all,
I want to return a varchar2(500) type of out parameter from a pl/sql stored procedure to a vb form?? how do i do this??
regards
akshayWell, when you create the parameter collection for your command object, just set the correct value for the direction component.
You would set it to one of the below, depending on if the parameter is IN OUT or only OUT:
<parameter_obj>.Direction = ParameterDirectionEnum.adParamInputOutput
<parameter_obj>.Direction = ParameterDirectionEnum.adParamOutput -
How to use the "out" parameter in idl
hello.idl:
module HelloApp
interface Hello
string sayHello();
void getPass(in string name,out string pass);
HelloServer:
public class HelloServer
class HelloServant extends _HelloImplBase
public void getPass(String name,org.omg.CORBA.StringHolder pass)
System.out.println("Server pass = " + pass);
if (name.equals("lxh"))
pass = new org.omg.CORBA.StringHolder("1234");
if (name.equals("cbj"))
pass = new org.omg.CORBA.StringHolder("5678");
HelloClient:
public class HelloClient
public static void main(String args[])
try{
org.omg.CORBA.StringHolder Pass = null;
if (args.length == 1)
System.out.println("Client pass = " + args[0]);
helloRef.getPass(args[0],Pass);
System.out.println(Pass);
} catch(Exception e) {
When I run client main method with parameter "lxh",I will get a error says the getPass() parameter which has given is wrong.
How to use the out parameter in client?Does this error only occurs if you pass "lxh" or always?
Did you try passing a StringHolder Object rather than a NULL Object?
Perhaps you can post the error message!? -
How to use the out parameter of a transformation
Hi All,
I have a requirement where I need to move all the transformations from process flows to map.SO for each transformation I need to have 1 map which calls this transformation.I have 1 transformation which has both input and output parameter.If I use this transformation in mapping then how to use the out parameter of thsi transformation.This out parameter needs to beused in other mappings.Can soemone please help me.
Thansk in advanceHi,
I'm not quite sure what you are trying to do.
What works: Connect the outgroup of a pre- or post-mapping process operator to the mapping output parameter operator..
What does not work: Connect the outgroup of an operator that can return more than one row (e.g. table operator, filter, joiner ,...) to the mapping output parameter operator. The mapping output parameter just returns "one row", like a pl/sql function call.
You cannot pass a "data stream" from one mapping to another. Maybe the pluggable mappings is what you are looking for.
Regards,
Carsten. -
How to retrieve the result parameter ?
Hello every body.
We have selected the result parameter checkbox in a method created in a ZXXX bussiness object. We need to know how to retrieve this result from the task.
Thank you in advance.
Juan.Hi Juan,
You can retrieve the result parameter from the method defining the Task.
Just double click on the task number and you will be taken to the "Standard Task: Change" screen.
Here Look out for a Small binding symbol in the Object Method cluster.
Click on the binding symbol and do the necessary binding to get the result from the method to the Task containers.
And subsequently, u can do the binding betweent the task containers and the workflow containers.
Hope this helps.
Regards,
Raj -
Getting the OUT of a MySQL stored procedure
I'm using MySQL database to log results of execution in TestStand. Stored procedures are used for all results logging. The very first procedure logs the general execution specific information and returns an auto-incremented index for ExecutionID, that index is used by other procedures during the execution as an unique execution identifier. I had some troubles initially with getting this index into TestStand, but after upgrading to ODBC 5.3 driver it was resolved and I got the out parameter from my procedure and put it into propagated local in TestStand.
Now the mistery. If executed once, everithing works fine, for the UUT Loop execution MySQL does not accept the same variable name again.
The error I'm getting is:
An error occurred calling 'LogMultipleResults' in 'ITSDBLog' of 'zNI TestStand Database Logging'
An error occurred executing a statement.
Statement: Insert_Execution.
Description: [MySQL][ODBC 5.3(a) Driver][mysqld-5.6.16-enterprise-commercial-advanced-log]OUT or INOUT argument 14 for routine Results_Database.Insert_Execution is not a variable or NEW pseudo-variable in BEFORE trigger
Number: -2147467259
NativeError: 1414
SQLState: S1000
Reported by: Microsoft OLE DB Provider for ODBC Drivers
Source: TSDBLog
MySQL return such kind of error if you, say, provide a constant as an output parameter instead of a valid variable name. So, it does not want to use a "stale" variable which was already used once during the execution. I do not see such things when MySQL procedures with OUT parameters are used by other MySQL procedures, so I suppose this is something between MySQL and TestStand. I've tried to use an array to store my execution ids for different loops and to use a new element for each loop, but I get the same error. Any ideas?
Sergey Kolbunov
CLA, CTDHi Sergey,
What version of TestStand are you using? It may also be useful to include any portions of your application if possible
I'm at a loss as to why you would be seeing this behavior. I doubt this will tell you anything helpful, but I threw in a couple of links to check out on the off chance you've configured something incorrectly:
Preparing to Implement Database Logging:
http://zone.ni.com/reference/en-XX/help/370052M-01/tsfundamentals/infotopics/database_logging/
Database Known Issues:
http://zone.ni.com/reference/en-XX/help/370052M-01/tsfundamentals/infotopics/database_known_issues/
Adding TestStand Results to a MySQL Database (this one's pretty dated):
http://www.ni.com/tutorial/3604/en/
Throw out any contextual information that might help give away where/why the error is occuring.
Neil
Applications Engineering
National Instruments
www.ni.com/support -
How to fetch %ROWTYPE OUT param of a stored procedure from Java program?
I have a stored procedure that has IN / OUT parameter as table_name%ROWTYPE.
From a java program how can I access this ROWTYPE variable?
I tried all possible documentation and none of the explains whether or not this is supported.
My use case expect exactly 1 record from the procedure and we would prefer not to use REF CURSOR.
Is there a way to achieve this? If so, can someone help me with it by posting the sample code to achieve this?
I tried all the possible OracleTypes to register the OutParameter and they all fail.
Looks like there isn't any equivalent of %ROWTYPE in OracleTypes either.
If you need, I can post my sample procedure that uses %ROWTYPE as OUT parameter.
I really appreciate your help in this regard.
- KarthikHi,
If "returning only 1 record" the showstopper for not using Ref Cursor, you might want to reconsider because as you probably know, the ref cursor is only a pointer and requires additional step to retrieve the data.
Kuassi -
How to view the returned data from a stored procedure in TOAD?
Hi,
I created ref cursor in the stored procedure to return data. The stored procedure works fine, just want to view the result in TOAD. The BEGIN... EXEC... END can execute the stored procedure, but how to make the result display?
Thanks!Right click the editor and choose
"Prompt For Substitution Variables".
Run for example the following code:
DECLARE
PROCEDURE p (cur OUT sys_refcursor)
AS
BEGIN
OPEN cur FOR
SELECT *
FROM DUAL;
END p;
BEGIN
p (:cur);
END;
The result will display in Toad's Data Grid!
Regards Michael -
Hi Experts,
I have on stored procedure which returns mote than one resultset i want that to store in two different temp table how can achieve this in SQL server.
following is the stored procedure and table that i need to create.
create procedure GetData as begin select * from Empselect * from Deptend
create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
Insert into #tmp1 (Ddeptid , deptname ,Location )
exec GetData
create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
Insert into #tmp (empId,ename,deptId,salary)
exec GetData
Niraj SevalkarYou cant get two resultsets out of SP like this. The workaround is to merge and bring the resultsets.
For this number of columns as well as corresponding datatypes have to be compatible. Also you will need one additional column which indicates resultset value. Then use this as filter to get your desired resultset out
create procedure GetData as
begin
select 'resultset1' as Cat,*,.. N columns from Emp
union all
select 'resultset2' as Cat,*,.. N columns from Dept
end
create table #tmp1 (Ddeptid int, deptname varchar(500),Location varchar(100))
Insert into #tmp1 (Ddeptid , deptname ,Location )
Select column1,column2,column3
from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
Integrated Security=SSPI','Execute yourdb..GetData')
WHERE Cat = 'resultset1'
create table #tmp (empid int , ename varchar(500),DeptId int , salary int)
Insert into #tmp (empId,ename,deptId,salary)
Select column1,column2,column3, column4
from OPENROWSET('SQLOLEDB','Data Source=Server_name;Trusted_Connection=yes;
Integrated Security=SSPI','Execute yourdb..GetData')
WHERE Cat = 'resultset2'
also see
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/11/26/select-columns-from-exec-procedure-name-is-this-possible.aspx
Another method is to populate table with relevant resultset within procedure itself and then select from the table directly outside.
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
CHAR as out parameter in a stored procedure
Reading a CHAR out parameter from a PL/SQL stored procedure with getString() returns a string with 32000 chars, instead of 3 (the original variable size). If the parameter is defined as varchar2, no problem occurs.
Here is an example:
create or replace procedure test2sp(c out char) as
begin
c := 'FOO';
end test2sp;
and here is the java code
java.sql.CallableStatement cs = conn.prepareCall("{ call test2sp(?) }");
cs.registerOutParameter(1, java.sql.Types.CHAR);
cs.execute();
String c = cs.getString(1);
bye,
nullPlease take a look at http://technet.oracle.com/doc/oracle8i_816/java.816/a81354/tips3.htm#1001047
Thanks. -
How to view the returned data from a stored procedure?
Hi,
I created ref cursor in the stored procedure to return data. But how can I view the data when I execute it? The stored procedure works fine, just want to view the result.
Thanks!SQL>set serveroutput on size 100000;
SQL>set autoprint on
SQL>variable cv refcursor;
SQL>exec proc_name(param1,:cv); -
How to passing array as parameter to oracle stored procedure from JPA
Hi All,
I need to call a stored proc in Oracle that accepts an array as input parameter.
Pls let me know how should i call it from my JPA. Is this even possible without using JDBC directly?
i keep getting the ff error:
wrong number or types of arguments in call to ....
my code is something like this:
String[] myArr...
Query query = em.createNativeQuery("BEGIN myStoredProc(:arr); END;");
query.setParameter("arr", myArr);
Thanks in advance.I also fail to get this done my code till now is:
PLSQL Function:
function getHtml(pWhere VARCHAR2 DEFAULT NULL,
pColSort HTP.STRINGARRAY) return clob is
begin
errorhndl.Log(pMessage => 'called');
htp.prn('das ist der test
for i in 1 .. pColSort.count loop
htp.p('
pColSort['||i||']: '||pColSort(i));
end loop;
htp.prn('
<table> <tr> <td> max1.0 </td> <td> max2.0 </td> </tr>');
htp.prn('<tr> <td> max1.1 </td> <td> max2.1 </td> </tr> </table>');
htp.prn('test ende');
return htp.gHtpPClob;
exception
when others then
null;
end getHtml;
PLSQL TYPE: (in HTP package - self created - but could be anywhere else too)
type STRINGARRAY is table of varchar2(256) index by binary_integer;
JAVA DOA:
public class ShowReportDOAImpl implements ShowReportDOA {
private JdbcTemplate jdbcTemplate;
private SimpleJdbcCall procShowReport;
public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
procShowReport = new SimpleJdbcCall(this.jdbcTemplate)
.withCatalogName("Show_Report")
.withFunctionName("getHtml")
.withoutProcedureColumnMetaDataAccess()
.declareParameters(
new SqlParameter("pWhere", Types.VARCHAR),
new SqlParameter("pColSort", Types.ARRAY, "HTP.STRINGARRAY"),
new SqlOutParameter("RETURN", Types.CLOB)
public String readReport(Long id, ParameterHelper ph) {
String[] sortCol = {"max", "michi", "stefan"};
String pWhere = "fritz";
MapSqlParameterSource parms = new MapSqlParameterSource();
parms.addValue("pWhere", pWhere);
parms.addValue("pColSort", sortCol, Types.ARRAY, "HTP.STRINGARRAY");
parms.addValue("pColSort", Arrays.asList(sortCol), Types.ARRAY, "HTP.STRINGARRAY");
Clob clob = procShowReport.executeFunction(Clob.class, parms);
String clobString = "";
try {
System.out.println("length: "+new Long(clob.length()).intValue());
clobString = clob.getSubString(1, new Long(clob.length()).intValue());
} catch (SQLException e) {
e.printStackTrace();
return clobString;
EXCEPTION IS:
org.springframework.jdbc.UncategorizedSQLException: CallableStatementCallback; uncategorized SQLException for SQL [{? = call SHOW_REPORT.GETHTML(?, ?)}]; SQL state [null]; error code [17059]; Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]; nested exception is java.sql.SQLException: Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:969)
org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:391)
org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:354)
org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
at.ontec.cat.config.doa.ShowReportDOAImpl.readReport(ShowReportDOAImpl.java:47)
at.ontec.cat.http.ShowReport.doGet(ShowReport.java:80)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
root cause
java.sql.SQLException: Konvertierung zu interner Darstellung nicht erfolgreich: [max, michi, stefan]
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:860)
oracle.sql.ARRAY.toARRAY(ARRAY.java:209)
oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7767)
oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7448)
oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7836)
oracle.jdbc.driver.OracleCallableStatement.setObject(OracleCallableStatement.java:4586)
org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:166)
org.springframework.jdbc.core.StatementCreatorUtils.setValue(StatementCreatorUtils.java:356)
org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:216)
org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:127)
org.springframework.jdbc.core.CallableStatementCreatorFactory$CallableStatementCreatorImpl.createCallableStatement(CallableStatementCreatorFactory.java:212)
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:947)
org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1003)
org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:391)
org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:354)
org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
at.ontec.cat.config.doa.ShowReportDOAImpl.readReport(ShowReportDOAImpl.java:47)
at.ontec.cat.http.ShowReport.doGet(ShowReport.java:80)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal(OpenEntityManagerInViewFilter.java:113)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
Please help!!
Please help!! -
How to retrieve the parameter names from a JSP page ? Urgent Please
Hello,
Can anybody tell me how to retrieve the parameter names from the JSP
page. (without using getParameterNames() method.)
The problem with the getParameterNames() method is I get the Jumbled output.
I need it very badly
With regards
Ananth R
email:[email protected]
[email protected]Dear duffymo,
My primary intention is to convert the JSP form information into a XML file.
If I do not get the Parameter names in the correct order how can I maintain
tag order in XML file.
For ex: (JSP PAGE VIEW)
Name--
FirstName
MiddleName
LastName
Address--
Street1
Street2
City
Country
&so on
(XML File to be generated)
<Name>
<FirstName>Value</FirstName>
</Name>
<Address>
<street1>value</street1>
</Address>
& so on
If I use getParameterNames() to get all the parameter names(Which form the tag names in the XML file ) the Enumeration object it returns will not be in the same order as the text fields in JSP.From this I can not construct a meaningful XML file.
order means: Order of entry on the page, from top to bottom
That's it
Waiting for your responses -
Do any of you apple geniuses out there know how to retrieve the answers to your security questions or at least reset them? Apparently its to much for the support team. Can't get an answer out of them...
Reset Security Questions
Frequently asked questions about Apple ID
Manage My Apple ID
Or you can email iTunes Support at iTunes Store Support.
If all else fails:
Go to: Apple Express Lane;
Under Product Categories choose iTunes;
Then choose iTunes Store;
Then choose Account Management;
Press Continue;
Now choose iTunes Store Security and answer the bullet questions, then click Continue;
Sign in with your Apple ID and press Continue;
Under Contact Options fill out the information and advise iTunes that you would like your security/challenge questions reset;
Click Send.
You should get a response within 24 hours by email.
Presently there appears to be problems on Apple's end, so it may be quite some time before they respond.
Another user posted the following:
I got some help from an apple assistant on the phone.
It is kind of round about way to get in
Here is what he said to do and it is working for me...
1) on the device that is asking you for the security questions go to "settings", > "store" > tap the Apple ID and choose view"Apple ID" and sign in.
2) Tap on payment information and add a credit/debit card of your preference then select "done", in the upper right corner
3) sign out and back into iTunes on the device by going to "settings"> "store" > tap the Apple ID and choose "sign-out" > Tap "sign -in" > "use existing Apple ID" and you should be asked to verify your security code for the credit /debit card and NOT the security questions.
4) At this time you can remove the card by going back in to edit the payment info and selecting "none" as the card type then saving the changes by selecting "done". You should now be able to use your iTunes store credit without answering the security questions.
It's working for me ...I just have to put in my 3 digit security pin from the credit card I am using.
Good Luck friends! -
i want to find out how to retrieve the serial number for my product. i can't find it in my email
Find your serial number quickly
Maybe you are looking for
-
can anybody help me here is my issue. Okay so I bought the January update for my iPod touch when it came out in January and a couple weeks ago I had to reinstall windows on my computer. I then had to restore my iPod Touch cause it went all screwy and
-
I tried to download a movie on my iPad but it didn't work... Is there some way I can access it on my computer now to download it? When I go to purchases in my iTunes it doesn't come up :-/
-
Adobe Flash Update infected Firefox with tons of viruses. Help!
I got with one of those annoying fake Adobe Flash Updates, and unfortunately fell for it and installed it, which has infected Firefox (and Chrome, and IE, for that matter) with tons of viruses that I CANNOT get rid of. I'm on a Windows 7 PC. Basicall
-
Transactions, Persistence Contexts and Entity Managers... Oh My!
Hi I am just getting into J2EE and EJB3. I have no prior experience with EJB2, we avoided it with our own POJO data access framework. With the advent of EJB3 we would like to use it in a new application. I am reading the book "Pro EJB 3" by Ketih and
-
What has happened? The URL http://sap-erp:8000/sap/bc/webdynpro/zz_01_sflight was not called due to an error. Note The following error text was processed in the system ER5 : WebDynpro Exception: Application /ZZ_01_SFLIGHT/ Does Not Exist The error oc