Call stored procedure in Visual Basic 6.0 and datatype CLOB
Hi
Has somebody a Visual Basic 6.0 Sample Code which can call the following example procedure.
test_package.getTestdata(
pPeid IN NUMBER,
pReturn OUT NUMBER,
pData OUT CLOB
Many Thanks in advance.
Best regards
Martin
hi,
give these links a try:
http://help.sap.com/saphelp_nw04/helpdata/en/7f/c6dc63c54811d194af00a0c94260a5/frameset.htm
and further:
http://help.sap.com/saphelp_nw04/helpdata/en/72/90fd343603c95ee10000009b38f844/frameset.htm
Similar Messages
-
Calling stored procedure inside AM. DB connection and updates on act/passiv
Hi Experts,
Currently in my application we have view objects and also we have some stored procedure calls to insert and update data (in the procedure we don't commit it. Due to the volume and complexity we couldn't migrate all the procedures). After the stored procedure call we do refresh the VO (Also in the EO we have checked necessary attributes to refresh on update and insert) to pick up the changes that happened in the stored procedure call. It is working fine and i can be able to see the updated values in the VO after the procedure call. However
Now my question is what will happen on activation and passivation? In the passivation the pinned DB connection is released and used for another AM. Will the stored changes will be rolled back. I mean the DB transaction. If rollback then the VO updates based on the procedure call will be also rolled back? I have tested this behaviour after disabled the AM pooling and set the pool size to 1. It is working but failing some times (In the procedure i have data insert for the child table, after the refresh i could be able to see the child VOs, some times empty child). Did anyone try this approach before?
Also what will happen if AM goes to passivation during the stored procedure executing ( i am getting the DB connection from getDBTransaction(() method). When i was testing i got the resultset null and i checked the stack and it was due to the connection closed). If AM behaves it like that is it reliable to use procedure call inside the AM?
Looking forward you expertise answers.
ThanksHi,
I agree with Frank.
In our application we always commit after calling PL/SQL procedures which performs DML-Statements (insert, update, delete).
Without commits you will - beside the passivation problem - face problems with locked records in the database.
To refresh the values from DB we use the "restore current row after rollback" approach (which is applicable for commit too).
regards
Peter -
Calling stored procedures with output parameters using RDO and VB
I have a simple test procedure defined as follows:
CREATE OR REPLACE PROCEDURE test_sp (inval1 IN VARCHAR2,
inval2 IN NUMBER, inval3 OUT VARCHAR2, inval4 OUT NUMBER) IS
BEGIN
inval3 := 'RETURN TEST';
inval4 := 10;
END;
I am attempting to call this procedure from VB 5.0 using RDO and the Oracle ODBC Driver 8.01.06:
dim rdoQd as rdoQuery
dim grdoCn as rdoConnection
strSQL = "{ call test_sp('SOMETHING',?,?,?) }"
Set rdoQd = grdoCn.CreateQuery("", strSQL)
rdoQd(0).Direction = rdParamInput
' get error# 40041 at above line
' "Object Collection: Couldn't ' find item indicated by text."
rdoQd(0).Type = rdTypeINTEGER
rdoQd(0).Value = 5
rdoQd(1).Direction = rdParamOutput
rdoQd(1).Type = rdTypeVARCHAR
rdoQd(2).Direction = rdParamOutput
rdoQd(2).Type = rdTypeINTEGER
Set rdoApp = rdoQd.OpenResultset()
MsgBox (CStr(rdoQd(1)))
MsgBox (CStr(rdoQd(2)))
When I run this VB code, I get the above mentioned error. If I use placeholders for all parameters (like "{ call test_sp (?,?,?,?) }" ), no error occurs.
I really need to use the first type of syntax from above and not have to use placeholders for all parameters. Is there a way to accomplish this?
TIA,
EstherAre you getting any warning while importing the stored procedure?
Please check the below datatypes:
While creating the stored procedure, if you have used varchar(MAX), please ALTER it to varchar(255) and reimport to DS.
Also, the datatype of $message (global variable or local variable) used inside DS should also be varchar(255)
Try a print statement in between.
ADMIN.DBO.SPJOBSUMMARY(69,$message,$rtCode,$rtVal);
print('Message is '||$message);
smtp_to('leighattest.com.au', 'Results of ' || job_name(), $rtCode || '//' || $rtVal || '~~' || $message || '//', 0,0);
and see in the job log if DS is able to retrieve the output from DB.
Regards,
Suneer -
Send SQL query or call stored procedure, which is best???
hello experts!!
i would like to ask what will be the best implementation on querying a database using Java, send a SQL query(insert into table values...) or call stored procedure(just pass parameters)?? and also in stored procedure does "autoCommit/rollback" applies/make sense??I searched google for this:
Stored Procedures vs. SQL
and found this useful link:
http://www.karlkatzke.com/stored-procedures-vs-sql-calls/
I thiink you should also read up on other articles based on such google searches
to get other opinions. Also, read the links provided by that article.
Personnally, I think stored procedures should be avoided unless there is a definite
advantage as specified in the above article. Especially not used for CRUD operations.
Also, no matter where you put the SQL, it should be documented. I've seen too many stored procedures that aren't documented. -
Creation of DB Adaptert for calling stored procedure in MS SQL server
Hi,
I need to create a DB adapter to call a stored procedure in MS SQL Server.
I have gone thru the thread MS SQL Server database connection
It mentions that we need to use a command line utility for generating the wsdl and xsd for calling stored procedures in MS SQL server. Please provide information where to find this utility and how to use it.
Any links to tutorials are welcome.
Thanks !!.
Silas.Command line is required for stored procedures, if you are using the basic options you don't need to worry.
(1) Download MS SQL Server 2005 JDBC Driver from Microsoft Site. http://msdn.microsoft.com/en-us/data/aa937724.aspx
(2) The download is self extracting exe file. Extract this into Program Files on your machine. It should create folder as "Microsoft SQL Server 2005 JDBC Driver"
(3) In above mentioned folder search for sqljdbc.jar copy this file into JDeveloper\JDBC\lib folder.
(4) Open JDeveloper/jdev/bin/jdev.conf file add following entry.
AddJavaLibPath C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib
While executing this step make sure that your JDeveloper is closed.
(5) On command prompt go to J Developer folder and execute following command
jdev -verbose
This will open JDeveloper.
(6) Now go to JDeveloper > Connections > Database Connections > New Database Connection
(7) Select Third Party JDBC
(8) Specify MS Sql Server User Name, password and Role.
(9) In connection page specify following
- Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver
- For class path browse to C:/Program files/Microsoft SQL Server 2000 Driver for JDBC/lib folder, select sqljdbc.jar add it as library.
- Specify URL as following.
jdbc:sqlserver://SERVERNAME:1433;databaseName=MSSQLDBNAME;
(10) Go to Test page and test it.
cheers
James -
Calling Stored Procedure with OraClob as parameter IN
I am using Visual C++ and using oo4o the ole way
I am try to call stored procedure that have Clob as parameter in
it seems the the OraParameters Add method don't have the ability since it can only receive variantt.
How do I do it
Thanks
Yoavfyi
Related to the solution/workaround posted by Luc.
see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
regards
Jan Vervecken -
Need sample source code for calling stored procedure in Oracle
Hi.
I try to call stored procedure in oracle using JCA JDBC.
Anybody have sample source code for that ?
Regards, Arnold.Thank you very much for a very quick reply. It worked, but I have an extended problem for which I would like to have a solution. Thank you very much in advance for your help. The problem is described below.
I have the Procedure defined as below in the SFCS1 package body
Procedure Company_Selection(O_Cursor IN OUT T_Cursor)
BEGIN
Open O_Cursor FOR
SELECT CompanyId, CompanyName
FROM Company
WHERE CompanyProvince IN ('AL','AK');
END Company_Selection;
In the Oracle Forms, I have a datablock based on the above stored procedure. When I execute the form and from the menu if I click on Execute Query the data block gets filled up with data (The datablock is configured to display 10 items as a tabular form).
At this point in time, I want to automate the process of displaying the data, hence I created a button and from there I want to call this stored procedure. So, in the button trigger I have the following statements
DECLARE
A SFCS1.T_Cursor;
BEGIN
SFCS1.Company_Selection(A);
go_Block ('Block36');
The cursor goes to the corresponding block, but does not display any data. Can you tell me how to get the data displayed. In the future versions, I'm planning to put variables in the WHERE clause. -
Call stored procedure with OUT parameter
Hello,
I have created a short-lived process. Within this process I am using the "FOUNDATION > JDBC > Call Stored Procedure" operation to call an Oracle procedure. This procedure has 3 parameters, 2 IN and 1 OUT parameter.
The procedure is being executed correctly. Both IN parameters receive the correct values but I am unable to get the OUT parameter's value in my process.
Rewriting the procedure as a function gives me an ORA-01460 since one of the parameters contains XML (>32K) so this is not option...
Has someone been able to call a stored procedure with an OUT parameter?
Regards,
NicoObject is Foundation, Execute Script
This is for a query, you can change to a stored procedure call. Pull the value back in the Java code then put into the process variable.
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.*;
PreparedStatement stmt = null;
Connection conn = null;
ResultSet rs = null;
try {
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:IDP_DS");
conn = ds.getConnection();
stmt = conn.prepareStatement("select FUBAR from TB_PT_FUBAR where PROCESS_INSTANCE_ID=?");
stmt.setLong(1, patExecContext.getProcessDataLongValue("/process_data/@inputID"));
rs = stmt.executeQuery();
rs.next();
patExecContext.setProcessDataStringValue("/process_data/outData", rs.getString(1));
} finally {
try {
rs.close();
} catch (Exception rse) {}
try {
stmt.close();
} catch (Exception sse) {}
try {
conn.close();
} catch (Exception cse) {} -
Calling Stored Procedure from Oracle DataBase using Sender JDBC (JDBC-JMS)
Hi All,
We have requirement to move the data from Database to Queue (Interface Flow: JDBC -> JMS).
Database is Oracle.
*Based on Event, data will be triggered into two tables: XX & YY. This event occurs twice daily.
Take one field: 'aa' in XX and compare it with the field: 'pp' in YY.
If both are equal, then
if the field: 'qq' in YY table equals to "Add" then take the data from the view table: 'Add_View'.
else if the field: 'qq' in YY table equals to "Modify" then take the data from the view table: 'Modify_View'.
Finally, We need to archive the selected data from the respective view table.*
From each table, data will come differently, means with different field names.
I thought of call Stored Procedure from Sender JDBC Adapter for the above requirement.
But I heard that, we cannot call stored procedure in Oracle through Sender JDBC as it returns Cursor instead of ResultSet.
Is there any way other than Stored Procedure?
How to handle Data Types as data is coming from two different tables?
Can we create one data type for two tables?
Is BPM required for this to collect data from two different tables?
Can somebody guide me on how to handle this?
Waiting eagerly for help which will be rewarded.
Thanks and Regards,
Jyothirmayi.Hi Gopal,
Thank you for your reply.
>Is there any way other than Stored Procedure?
Can you try configuring sender adapter to poll the data in intervals. You can configure Automatic TIme planning (ATP) in the sender jdbc channel.
I need to select the data from different tables based on some conditions. Let me simplify that.
Suppose Table1 contains 'n' no of rows. For each row, I need to test two conditions where only one condition will be satisfied. If 1st condition is satisfied, then data needs to be taken from Table2 else data needs to be taken from Table3.
How can we meet this by configuring sender adapter with ATP?
================================================================================================
>How to handle Data Types as data is coming from two different tables?
If you use join query in the select statement field of the channel then whatever you need select fields will be returned. This might be fields of two tables. your datatype fields are combination of two diff table.
we need to take data only from one table at a time. It is not join of two tables.
================================================================================================
Thanks,
Jyothirmayi. -
Calling Stored Procedure with in Stored Procedure
I have one stored procedure A, I want to call Stored procedure A from Stored Procedure B and want to give input parameter to Stored Procedure A within Stored Procedure B using while loop.
i.e I have one stored procedure A which uses Telephone number as input parameter and pull out data
I want to create one more stored procedure B which will call stored procedure A internally and give telephone number one by one using while loop and push the result in Table C.>
I have one stored procedure A, I want to call Stored procedure A from Stored Procedure B and want to give input parameter to Stored Procedure A within Stored Procedure B using while loop.
i.e I have one stored procedure A which uses Telephone number as input parameter and pull out data
I want to create one more stored procedure B which will call stored procedure A internally and give telephone number one by one using while loop and push the result in Table C.
>
Doesn't sound a good idea in terms of performance or design. OK, what's your query?
The concept is:
create or replace procedure Proc_A (p_phone varchar2)
is
Begin
Insert into Tablec (col1, col2, col3, phone) values (val1, val2, val3, p_phone);
Exception
When no_data_found then
do what...
End;
Create or Replace Procedure Proc_B as
Begin
For i in (select phone_no from customer)
Loop
Proc_A(i.phone_no);
End Loop;
End;
/Once again, I have to say, it's a bad idea. You may well do it within a single procedure or even a single SQL. Tell us your exact requirements and we'll be able to help you
Edited by: user12035575 on Sep 5, 2011 8:26 PM -
Calling Stored Procedure without JDBC-Adapter
Hallo,
as it is not possible calling Stored Procedures with the parameter Typ Record in Oracle my question: It is possible connecting to DB using native java-code for example in Mapping?
Thanks in advance,
FrankHi Frank,
Maybe you can use the DB look up using the JDBC adapter in your mapping.
Just check this blog for the same,
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
As for calling an Oracle Strored Procedure, it is possible using a RECEIVER JDBC adapter, but not a SENDER JDBC adapter.
<i> import the jdbc-driver (oracle) in an archive in Designer.</i>
Also, this imported archive should be under any Namespace, but, it should be in the same SWCV as the one in which the mapping is being executed.
Regards,
Bhavesh -
CALLING STORED PROCEDURE IN DATABASE FROM FORMS4.5
Is there any body know how to call stored procedure from Forms 4.5 ?
I am writing a when-button-pressed trigger.
Put the stored procedure name on there. But
it said "stored procedure name is not declared on this scope".
Thanks a lot
nullTry logging in to SQL*Plus and running the procedure, e.g....
SQL> begin
database_procedure_name(update_web);
end;
If it runs OK there, then it should run from within your form (provided that you are logged in as the same user as the test with SQL*Plus. -
Calling stored procedure in OCCI
Hi, Guys.
I triy to call stored procedure in Oracle database server.But i have problems with taking of the OUT parameters.
How to call the procedure corectly?
Depend on Oracle manual everything is fine but as we see that is not.
Here is the 2 lines that make the problem.
statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
I can't access Type::OCCIINT and Type::OCCIString.
I tried and Type::OCCISTRING but without any result.
Can you help me?
This is the all code i use:
Environment *env = Environment::createEnvironment ( Environment::DEFAULT );
Connection *conn = env->createConnection ( user, pass, osid );
Statement * statement = conn->createStatement ( query );
ResultSet * result = statement->executeQuery ( query );
result->setCharacterStreamMode ( 2, 10000 );
statement->setSQL ( "BEGIN tracetst.get_tst_moduls ( :1, :2, :3 ); END:" );
int if_false;
string __result;
statement->setString ( 1, "116714020010" );
statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
statement->executeUpdate();
if_false = statement->getInt (2);
/* Set the 1,2 args into err_result and modules. The action is only with these */
err_result = if_false;
__result = statement->getString (3);
cout << if_false;
cout << __result;
//printf ( result );
//statement->executeUpdate ( query );
env->terminateConnection ( conn );
Environment :: terminateEnvironment ( env );
While compiling I have an error message.Here it is :
trace.cpp: In member function `const char* oracle_io::get_data()':
trace.cpp:668: error: `oracle::occi::Type' is not an aggregate type
Tha is the line adn the next line is same :
statement->registerOutParam(2, Type::OCCIINT, sizeof ( if_false ) );
statement->registerOutParam(3, Type::OCCIString, sizeof ( __result ) );
How to call the procedure corectly?
Depend on Oracle manual everything is fine but as we see that is not.
Thanks in advance.
P.S. I would like to thanks to Amogh for helping me before.Did you remove the colon after END ?
Environment *env = Environment::createEnvironment(Environment::OBJECT);
Connection *conn = env->createConnection("scott","tiger","inst1");
Statement *stmt;
int num; string name;
try
stmt=conn->createStatement();
stmt->setSQL ( "BEGIN scott.test ( :1, :2, :3 ); END;" );
stmt->setString ( 1, "11" );
stmt->registerOutParam(2, OCCIINT,sizeof(num));
stmt->registerOutParam(3, OCCISTRING,sizeof(name));
stmt->execute();
num=stmt->getInt(2); name=stmt->getString(3);
cout<<num<<" "<<name<<endl;
catch (SQLException &ex)
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
cout<<ex.getMessage();
env->terminateConnection(conn);
Environment::terminateEnvironment(env);
...Rgds.
Amogh -
JDBC-Adapter-Receiver Calling Stored Procedure with Input-Typ Record
Hallo,
I´ m trying calling a stored-procedure with two input-parameter; one of typ record (oracle) and one of type tabel of records. Is this possible (I think there are only types like string, integer etc. possible)? When not is there another possibility to work with that type?
Thanks in advance,
FrankHi Frank,
I think stored procedures will not take Array of Records as a Input. If you want to make a loop funtionality etc then JDBC adapter will work accordingly. You need to just call the stored procedure from the JDBC adapter. It will work for the array of records(multiple occurences).
Receiver JDBC Procedures.
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
Alternative option is you can make use of Java Proxy and from there you can call stored procedure ..I think it is possible.. not tried.
Hope this helps
Regards,
Moorthy -
Calling Stored procedure with Parameters in PowerPivot DataModel
Hi All,
I wanted to call a SQL stored procedure from PowerPivot(Excel) on based on changing slicer's value.
Currently, we can call stored procedure wihtout any parameter from Data Model tab using
Exec stored_proc_name in Table Properties window.
What if I want to call the same procedure with a parameter whouse value will come by changing slicer's value. I meant, changing slicer value will act as a parameter to that stored procedure & it should return updated results.
Is this possible in PowerPivot?Hi Rameshwar,
According to your description, you call a SQL Server stored procedure in PowerPivot data model, now the problem is that you need to pass a parameter to the stored procedure, right?
Based on my research, it seems that we cannot achieve this requirement directly in current version of PowerPivot data model. Here is a similar thread for you reference.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/5350228d-bc62-4a3b-a1a6-e847483e2858/powerpivot-for-excel-2013-call-execute-stored-procedure-with-parameters?forum=sqlkjpowerpivotforexcel
If you have any concern about this behavior, you can submit a feedback at
http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product. Your feedback enables Microsoft to make software and services the best that they can be, Microsoft might consider to add this feature
in the following release after official confirmation.
Regards,
Charlie Liao
TechNet Community Support
Maybe you are looking for
-
How do I partition an external HD without formatting it or deleting data on it?
I'm using OSX Lion and have an external HD, which is about 40% full. I'd like to add a partition without reformatting it or deleting data if that's possible. Anyone know how to do this? I've opened up Disk Utility and clicked on the Partition tab and
-
Dear all, first of all thanks for reading this topic :-) In our enviroment, we have a Exchange 2010 server (Version: 14.01.0438.000), whitch is installed with all server roles (CAS, HT and MB) on one server(OS is Windows Server 2008 R2 Enterprise). T
-
My macbook is running Mac OS X 10.7.1 (LION). Everytime I try to restart Mac OS and load until the login page, I try to enter the password. Once I key in the first few character, the system hang and the spinning ball will keep spinning non stop. May
-
Url iView: passing user/pass as get variables. Launching in new window
Hi, I pass username and password as get variables from a url iView, and want a page containing this iView to open in a new page using the "Launch in new window" property set to "Display in a separate window". When previewing the iView or page it is
-
Your thoughts please on getting me out of this problem
I have the latest version of iphoto 4 and have the spinning wheel when loading iphoto. So I need to rebuild the library which I know how to do. My problem is the library is 24GB with 2500 photos in it. I can only free up 17 GB of space on the hard dr