Multiple SQL statements from JDBC
Dear All,
We are working on R/3- >XI->JDBC scenario. We have sender as Proxy which sends some data to XI which needs to be Updated in multiple database tables in oracle. We have few Insert,Update and Delete Query to be
Hi
yes this can be done by using the concept IDOC to JDBC
ALe settings for thi s are :
Steps for XI
Step 1)
Goto SM59.
Create new RFC destination of type 3(Abap connection).
Give a suitable name and description.
Give the Ip address of the R3 system.
Give the system number.
Give the gateway host name and gateway service (3300 + system number).
Go to the logon security tab.
Give the lang, client, username and password.
Test connection and remote logon.
Step 2)
Goto IDX1.
Create a new port.
Give the port name.
Give the client number for the R3 system.
Select the created Rfc Destination.
Step 3)
Goto IDX2
Create a new Meta data.
Give the Idoc type.
Select the created port.
Steps for R3.
Step 1)
Goto SM59.
Create new RFC destination of type 3(Abap connection).
Give a suitable name and description.
Give the Ip address of the XI system.
Give the system number.
Give the gateway host name and gateway service (3300 + system number).
Go to the logon security tab.
Give the lang, client, username and password.
Test connection and remote logon.
Step 2)
Goto WE21.
Create a port under transactional RFC.(R3->XI)
Designate the RFC destination created in prev step.
Step 3)
Goto SALE.
Basic settings->Logical Systems->Define logical system.
Create two logical systems(one for XI and the other for R3)
Basic settings->Logical Systems->Assign logical system.
Assign the R3 logical system to respective client.
Step 4)
Goto WE20.
Partner type LS.
Create two partner profile(one for XI the other for R3).
Give the outbound or inbound message type based on the direction.
Step 5)
Not mandatory.
Goto BD64.
Click on Create model view.
Add message type.
Step 6)
Goto WE19
Give the basic type and execute.
fill in the required fields.
Goto IDOC->edit control records.
Give the following values.(Receiver port,partner no.,part type and sender Partner no. and type)
Click outbound processing.
Step 7)
Go to SM58
if there are any messages then there is some error in execution.
Goto WE02.
Check the status of the IDOC.
Goto WE47.
TO decode the status code.
BD87 to check the status of IDOC.
In case if not authorized then go to the target system and check in SU53, see for the missing object
and assign it to the user.
for scenario reffer link
Configuring JDBC Connector Service To Perform Database Lookups
http://searchsap.techtarget.com/tip/0,289483,sid21_gci1246926,00.html
Configuration of JDBC Adapter for SQL Server
JDBC Driver = com.microsoft.jdbc.sqlserver.SQLServerDriver
Connection = jdbc:microsoft:sqlserver://hostname:<port>;DatabaseName=<DBName>
UserID and Password
Configuring the Receiver JDBC Adapter
http://help.sap.com/saphelp_nw2004s/helpdata/en/b0/676b3c255b1475e10000000a114084/content.htm
hope this helps you
Regard's
Chetan Ahuja
Similar Messages
-
Where to see generated SQL statement from jdbc adapter?
Hi everybody,
where can I see the generated SQL statement from JDBC adapter?
Regards MarioYes and True lterally means the same, but alas XI does not understand literature..
Just checked the note as well, as you are correct!
Regards
Bhavesh -
Multiple sql statements from java
I am executing sql statements in MaxDB 7.6.04.12 from java using jdbc.
I want to execute multiple statements at a time, but it seems that however I separate the statements, I get
com.sap.dbtech.jdbc.exceptions.DatabaseException: [-3014] (at 433): Invalid end of SQL statement
I have tried separating the statements with just a semi-colon, with a semi-colon and new line, with newline-//-newline (as works with SQL Studio), but whatever I try I get this error or some other.
Is it possible to do this? and if so how?
Thanks
ChrisHi Lars,
Here are the relevant bits of code.
However I'm not sure how helpful that will be - I'm using the SpringFramework for my jdbc calls, as it saves a lot of time and effort, and my calls are to Spring methods, which are wrappers round the base jdbc calls.
I'll post it anyway, just in case you're familiar with Spring. I haven't looked at the Spring code, but my understanding is it pretty much just passes the sql to standard jdbc calls.
I guess my next step would be to trace through the Spring code as it executes and see if anything becomes apparent. However I'm under some time pressure and was hoping to avoid that.
My other alternative is to create non-temporary tables, and drop them explicitly when I've finished with them.
public Set<String> getPriceUpdatedProducts() {
final Set<String> prods = new TreeSet<String>();
String sql;
int updates;
// need single connection template so subsequent statements can access temp tables:
JdbcTemplate jtSingle = getSingleConTemplate(jdbcTemplate);
// inDCs is a list of dist channels for an sql 'in' statement:
String inDCs = "";
for (String siteId: siteConfig.getAllSiteIds()) {
if (!"".equals(inDCs)) inDCs += ",";
inDCs += "'" + siteConfig.getSiteIdProperty(siteId, "distChanId") + "'";
// Clear all the changed flags from the last run:
updates = jtSingle.update("update zchangedartdc set changed = '' ");
// Get the current data into a temp table:
sql = "create table temp.pricechanges as " +
"select A304.matnr, A304.vtweg, konp.kbetr price " +
" from A304 join konp " +
" on A304.knumh = konp.knumh " +
" and A304.mandt = konp.mandt " +
" and A304.vkorg = '" + salesOrg + "' " +
" and A304.vtweg in (" + inDCs + ")" +
" and A304.kschl = '" + rrpCondType + "' " +
" and A304.mandt = '" + sapClient + "' " +
" and konp.kschl = '" + listCondType + "' " +
" and char(date, internal) >= chr(A304.datab) " +
" and char(date, internal) <= chr(A304.datbi) " +
" and A304.kappl = 'V' ";
jtSingle.execute(sql);
// Get the changes into a second temp table:
sql = "create table temp.changedarts as " +
"select temp.pricechanges.* " +
" from temp.pricechanges, zchangedartdc " +
" where zchangedartdc.matnr = temp.pricechanges.matnr " +
" and zchangedartdc.vtweg = temp.pricechanges.vtweg " +
" and zchangedartdc.price != temp.pricechanges.price ";
jtSingle.execute(sql);
// save the changes, and flag them:
sql = "update zchangedartdc " +
" set (price, changed) = (select price, 'X' " +
" from temp.changedarts " +
" where zchangedartdc.matnr = temp.changedarts.matnr " +
" and zchangedartdc.vtweg = temp.changedarts.vtweg) " +
" where matnr||vtweg in (select matnr||vtweg from temp.changedarts) ";
updates = jtSingle.update(sql);
// add the new items that weren't there last time, and flag them:
sql = "insert into zchangedartdc " +
"select '" + sapClient + "', matnr, vtweg, 'X', price " +
" from temp.pricechanges " +
" where matnr||vtweg not in (select matnr||vtweg from zchangedartdc) ";
updates = jtSingle.update(sql);
// now we've got all the changes flagged, we can get the list of changed products:
jtSingle.query("select distinct matnr from zchangedartdc " +
" where changed = 'X' ",
new RowCallbackHandler() {
public void processRow(ResultSet rs) throws SQLException {
prods.add(rs.getString("matnr"));
// release the connection:
destroySingleConnection(jtSingle);
return prods;
* Return a JdbcTemplate which will always use the same connection. Parameter jt is just
* a convenient way to get a DataSource from which to get a Connection.
* When the calling prodedure has finished, it MUST call
* destroySingleConnection(jt)
* @param jt
* @return
private JdbcTemplate getSingleConTemplate(JdbcTemplate jt) {
Connection con;
try {
con = jt.getDataSource().getConnection();
con.setAutoCommit(true);
} catch (SQLException e) {
throw new DataAccessResourceFailureException("Failed to get Connection for SingleConnectionDataSource", e);
SingleConnectionDataSource singleDs = new SingleConnectionDataSource(con, true);
return new JdbcTemplate(singleDs);
private void destroySingleConnection(JdbcTemplate singleConJt) {
try{
((SingleConnectionDataSource)singleConJt.getDataSource()).destroy();
} catch (SQLException e) {
throw new DataAccessResourceFailureException("Failed to destroy SingleConnectionDataSource", e); -
Running multiple SQL statements from DBMS_SCHEDULER
DB Version : 10.2.0.4
After refering the following document, i am trying to create a job which will run 2 SQLs ; An INSERT and an UPDATE as shown below.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/jobtosched.htm#i1018602
create table xyz (empid number,empname varchar2(35),cre_dt date);
BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'job32',
job_type => 'PLSQL_BLOCK',
job_action => 'INSERT INTO XYZ VALUES (7935, ''SALLY'',SYSDATE),'UPDATE MANU.XYZ SET EMPID = 33';
start_date => SYSDATE,
repeat_interval => 'FREQ = DAILY; INTERVAL = 1');
END;
/But i am getting errors like below, when i try to create the above job.
ORA-01756: quoted string not properly terminated
PLS-00103: Encountered the symbol ";" when expecting one of the following:You need to enclose those statements in an anonymous PL/SQL block
BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'job32',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN INSERT INTO XYZ VALUES (7935, ''SALLY'',SYSDATE); UPDATE MANU.XYZ SET EMPID = 33; END;'
start_date => SYSDATE,
repeat_interval => 'FREQ = DAILY; INTERVAL = 1');
END;
/ -
Executing multiple sql statements from a single sql file
Hi, I am Vijay Krishna.
I want to drop user, drop tablespace, create tablespace and create user from a single executable file or a single sql file. The command should be in sequence. How can we achieve it? Can I anybody help me in this regard. I want this as soon as possible. It's urgent. Kindly post a reply.
Also, how can we know the oracle home directory from a java program? The problem is we should know the Oracle home directory and use it for creating the tablespace. In the userinterface we will give just for a new database user creation. I will be really thankfull if anybody can help me in this regard.It is showing any error messages.
I will diplay the entire batch file which we are using.
sqlplus / as sysdba
drop user examination cascade;
drop tablespace examination;
create tablespace examination
datafile 'C:\oracle\product\10.1.0\oradata\orcl\examination.dbf'
size 500M autoextend on;
create user examination identified by examination
default tablespace examination
quota unlimited on examination;
grant connect, resource to examination;
exit;
when i run the batch file from the DOS prompt it is entering into the sql prompt and coming out in a fraction of a second. We are just seeing a screen coming and going. But no error messages are being displayed.
first we thought that as we are giving the create tablespace and create user in the same file we created another file and tried without having the create commands. Even then the user didn't get dropped. -
Workspace to parse SQL statements from multiple database schema's
Hi ,
When go through the following link of workspace admin user :
Home>HTML DB Workspace Administration>Manage Services>Schema Reports>Workspace Schemas there I saw "Your workspace has the privilege to parse SQL statements using the following database schemas. Note that the terms database schema and database user can be used interchangeably.
" at the right pane.
So how can i make my workspace to parse SQL statements from multiple database schema's ?That must be listed there .But i have only one schema in view ? Can i make it multiple ?If then How ?
Anybody have an idea ?
ROSYAssign as many schemas to your workspace as you want using the administration app. Read about it in the doc.
Scott -
Multiple SQL statements in Init SQL in WLS 8.1
How to seperate multiple SQL statements in Init SQL text box ?
For example, I want to enter following two SQL statements. How do I seperate them.
I tested with / and ; as seperator, but did not worked..
alter session set nls_date_format = 'MM/DD/YYYY'
set role xxx_role identified by xxxxMahendra wrote:
Thanks Joe.
Following worked for Oracle 8.1.7Good news.
but did not for 8.0.6
SQL BEGIN EXECUTE IMMEDIATE 'ALTER SESSION SET nls_date_format = ''MM/DD/YYYY''';
EXECUTE IMMEDIATE 'SET ROLE xxx identified xxx'; end;
Do you know 8.0.6 syntax ?You might try asking oracle, but note that no one is supporting that old version
of Oracle any longer...
Joe
>
Mahendra
Joe Weinstein <[email protected]> wrote:
Hi.
I found the syntax, I think. Try this:
BEGIN EXECUTE IMMEDIATE 'ALTER SESSION SET nls_date_format = 'MM/DD/YYYY'';
EXECUTE IMMEDIATE 'SET ROLE <<role name>> identified
by <<pwd>>';END;
Joe
Mahendra wrote:
Still getting following exception.
<Feb 19, 2004 1:47:58 PM EST>
<Warning>
<JDBC> <BEA-001164>
<Unable to initialize connection in pool "XXXX".
Initialization
SQL = "BEGIN alter session set nls_date_format = 'MM/DD/YYYY'; setrole xxxx_role
identified by
xxxx; END;".
Received exception: "java.sql.SQLException: ORA-06550: line 1,column7:
PLS-00103: Encountered the symbol "ALTER" when expecting one of thefollowing:
begin declare exit for goto if loop mod null pragma raise
return select update while <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql commit <a single-quoted SQL string>
The symbol "update was inserted before "ALTER" to continue.
ORA-06550: line 1, column 61:
PLS-00103: Encountered the symbol "ROLE" when expecting one of thefollowing:
transaction
".>
<Feb 19, 2004 1:47:59 PM EST> <Notice> <WebLogicServer> <BEA-000355><Thread "Li
Joe Weinstein <[email protected]> wrote:
Mahendra wrote:
Thanks for reply, but that did not worked.
Get following exception
Unable to initialize connection pool "POOL_NAME".
Initialization SQL = "Select count(*) from ""SQL BEGIN alter sessionset nls_date_format
= 'MM/DD/YYYY'; set role xxx_role identified by xxxx; END;"". Receivedexception:
"java.sql.SQLException: ORA-00972: identifier is too long
Since we have not given SQL before that statement, BEA is treating
statment "SQL Begin ....." as a table name.
Then I tried by putting SQL out side quotes, like SQL "Begin .....end;" but the
same error.
Is there any way around it ?
MahendraHi. The full string you should enter into the console when you define
the
initSQL parameter is:
SQL BEGIN alter session set nls_date_format = 'MM/DD/YYYY'; set role
xxx_role identified by xxxx; END;
Let me know...
Joe
Joe Weinstein <[email protected]> wrote:
Mahendra wrote:
How to seperate multiple SQL statements in Init SQL text box ?
For example, I want to enter following two SQL statements. How do
I
seperate them.
I tested with / and ; as seperator, but did not worked..
alter session set nls_date_format = 'MM/DD/YYYY'
set role xxx_role identified by xxxxThis will always be DBMS-specific. If this is for oracle, you can
try:
"SQL BEGIN alter session set nls_date_format = 'MM/DD/YYYY'; setrole
xxx_role identified by xxxx; END;"
Joe -
How to store data into database by reading sql statements from text file
how to write java program for storing data into database by reading sql statements from text file
Step 1: Create a property file to add various queries.
Step 2: Read the properties file using ResourceBundle
Step 3: Use the jdbc to execute the query read from the property file.
So in future if you need to change query no need do any modifications in java program. But depends on how you use the property file. -
How Can I Retrieve SQL Statement From The User ?
Hi
I want to know, how can I make the user can enter the SQL statement from himself ?? in this code he can't enter it. Only he can display the SQL that i wrote it...
this is my Code:
import java.sql.*;
public class db_testing {
static final String DRIVER = "com.mysql.jdbc.Driver";
static final String DATABASE_URL = "jdbc:mysql://localhost/S204111933";
public static void main(String[] args) {
Connection cn=null;
Statement st= null;
ResultSet rset=null;
try{
Class.forName(DRIVER);
cn=DriverManager.getConnection(DATABASE_URL, "root", "admin");
st=cn.createStatement();
rset=st.executeQuery("select * from employee");
ResultSetMetaData metadata=rset.getMetaData();
System.out.println("The begining: ");
for(int i=1;i<=metadata.getColumnCount();i++)
System.out.print(metadata.getColumnName(i)+"\t");
System.out.println();
System.out.println();
while(rset.next()){
for(int i=1;i<=metadata.getColumnCount();i++)
System.out.print(rset.getObject(i)+"\t\t");
System.out.println();}
catch(Exception e){
e.printStackTrace();
finally{
try{
cn.close();
st.close();
rset.close();
catch(Exception e1){
e1.printStackTrace();
}The following changes in the code will make the user to give the input
import java.sql.*;
public class db_testing {
static final String DRIVER = "com.mysql.jdbc.Driver";
static final String DATABASE_URL = "jdbc:mysql://localhost/S204111933";
public static void main(String[] args) {
Connection cn=null;
Statement st= null;
ResultSet rset=null;
try{
Class.forName(DRIVER);
cn=DriverManager.getConnection(DATABASE_URL, "root", "admin");
// st=cn.createStatement();
// rset=st.executeQuery("select * from employee");
PreparedStatement pstmt=null;
pstmt=cn.prepareStatement("select * from employee where id=?");
pstmt.setInt(1,Integer.parseInt(args[0]));
rset=pstmt.executeQuery();
ResultSetMetaData metadata=rset.getMetaData();
System.out.println("The begining: ");
for(int i=1;i<=metadata.getColumnCount();i++)
System.out.print(metadata.getColumnName(i)+"\t");
System.out.println();
System.out.println();
while(rset.next()){
for(int i=1;i<=metadata.getColumnCount();i++)
System.out.print(rset.getObject(i)+"\t\t");
System.out.println();}
catch(Exception e){
e.printStackTrace();
finally{
try{
cn.close();
st.close();
rset.close();
catch(Exception e1){
e1.printStackTrace();
} -
How to execute multiple sql statements
hi all
i am wondering if i can execute multiple sql statements in one shot with >> execute immediate command
for example:
i define the variable as X := sql statement
Y := sql statement
z := sql statement
can i do execute immediate (X,Y, Z);
if yes how ?? and if not any possible alternate
thanksStarting with Ganesh's code
DECLARE
l_statement VARCHAR2 (2000);
v_passwd VARCHAR2 (200);
v_username VARCHAR2 (200) := 'test';
v_pwd_key VARCHAR2 (200) := 'lwty23';
v_dblink_name VARCHAR2 (2000);
v_dblink_drop VARCHAR2 (2000);
v_dblink_create VARCHAR2 (2000);
v_dblink_check_connection VARCHAR2 (2000);
l_number NUMBER;
BEGIN
--<<c_instance>>
FOR c_instance IN (SELECT *
FROM v_oracle_instances
WHERE environment = 'Developement')
LOOP
SELECT encpwd_owner.display_db_encpwd (v_username,
c_instance.host_name,
c_instance.instance_name,
v_pwd_key)
INTO v_passwd
FROM DUAL;
v_dblink_name := c_instance.host_name || '_' || c_instance.instance_name;
v_dblink_create :=
' CREATE DATABASE LINK '
|| v_dblink_name
|| ' CONNECT TO '
|| v_username
|| ' '
|| 'IDENTIFIED BY '
|| v_passwd
|| ' USING'
|| ' ''(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST= '
|| c_instance.host_name
|| ')(PORT='
|| c_instance.LISTENER_PORT
|| '))(CONNECT_DATA=(SID='
|| c_instance.instance_name
|| ')))''';
v_dblink_check_connection := 'select 1 from global_name@' || v_dblink_name || '.QCM'; --- Notice this change. I am simply selecting 1. That should be enough to test the database link.
v_dblink_drop := 'drop database link ' || v_dblink_name || '.QCMTLAF';
-- l_statement := 'BEGIN ' || v_dblink_create ';' || v_dblink_check_connection ';' || v_dblink_drop '; END ;'
BEGIN
EXECUTE IMMEDIATE (v_dblink_create);
DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Created');
EXCEPTION
WHEN others THEN
dbms_output.put_line( 'Failed to create the database link ' || v_dblink_name );
dbms_output.put_line( dbms_utility.format_error_backtrace() );
INSERT INTO error_table( column_list )
VALUES( <<list of values>> );
END;
EXECUTE IMMEDIATE (v_dblink_check_connection) INTO l_number; --- Notice this.
DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Tested');
BEGIN
EXECUTE IMMEDIATE (v_dblink_drop);
DBMS_OUTPUT.PUT_LINE ('DB Link ' || v_dblink_name || ' Dropped');
EXCEPTION
WHEN others THEN
dbms_output.put_line( 'Failed to drop the database link ' || v_dblink_name );
dbms_output.put_line( dbms_utility.format_error_backtrace() );
INSERT INTO error_table( column_list )
VALUES( <<list of values>> );
END;
END LOOP;
END;But I agree with the point that others have brought up that it really doesn't make sense to create and drop a database link like this.
Justin -
CF8 cfquery multiple sql statements
In CF8, when I run a cfquery against MS SQL 2005 with
multiple SQL statements, the query return the result of the first
statement not the last one as in CF7. The following code snippet
will cause an error because myID doesn't exist in qry. I know I
should set a "result" variable to get the identity key in CF8 but
we have some sites deployed in CF7. Before all sites migrate to
CF8, I would like to have a way to use the same code for both CF7
and CF8 so I don't have to maintain two versions. BTW, I tried
three datasourcr drivers: "Microsoft SQL Server", "Other" with
JDBC, and "ODBC Socket" with SQL Native Client. All of them gave
the same result. Please help. Thanks.Hi Alex Pai,
Coincidentally, someone just asked a similar question
here.
So you might try searching the forums first. The query in the other
thread is slightly different, but the answer is the same.
Totally unrelated to your problem, but for SQL 2000/2005 you
should use scope_identity(), not @@identity. -
Excuting multiple sql statements
Hi to everybody.
I'm quite new to Oracle even if i have quite a big experience with MySQL and SQL commands. I'm facing a problem that I suppose it is a really basic one.
I received a dump of an Oracle database in a .sql format. I mean that both the schema and the data are build through a large number of sql statements. In particular the schema is made through a lot of "create table ..." while the data are built through "insert into..". My need is to import these database in a fresh Oracle database Oracle 10 g XE.
I've installed it on a Debian system and i can succesfully execute a single SQL command both through the web interface http://localhost:8080/apex and logging as oracle user through the sqlplus username/passwd command.
My problem is that the data are split on about 12000 SQL "INSERT INTO.." so executing all of them one by one could be a little annoying :-)
<u>So I'm asking if there is a way to instruct Oracle to execute multiple SQL statements reading it from a file (like MySQL does for example).</u>
I' m considering to write a script to do it if there's no better way. I know that there're better way to dump databases in Oracle but I can change the .sql format since it is the only one that I got.in SQL*Plus you can execute a SQL file with the start command or it's shorthand version @:SQL> start filename.sql
or
SQL> @filename.sql -
Executing multiple SQL statements fails using ODBC
Executing multiple SQL statements will fail with error 'ORA-00911 invalid character' when connecting to an Oracle database using ODBC driver version 8.01.07.00.
When I use either my application or the Oracle ODBC Test client utility connecting using ODBC driver version 8.01.07.00 I can only get a single CALL statement (as shown below) to execute:
CALL BHInsert (TO_DATE('2003.07.23 10:04:28','YYYY.MM.DD HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','
','Event File
Name','\\KILLIANS\BATCHCTL\SampleDemo1\JOURNALS\1.evt','','AREA1','','','','','','1','','','','','',' ','');
When I try to execute the following string with multiple CALL statements (as shown below) it fails with the following error being returned - ORA-00911: invalid character
CALL BHInsert (TO_DATE('2003.07.23 10:04:28','YYYY.MM.DD HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','
','Event File
Name','\\KILLIANS\BATCHCTL\SampleDemo1\JOURNALS\1.evt','','AREA1','','','','','','1','','','','','',' ','');
CALL BHInsert (TO_DATE('2003.07.23 10:04:28','YYYY.MM.DD
HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','Version','Recipe Header','1.0','','AREA1',' ','
','','','','1','','','','','',' ','');
CALL BHInsert (TO_DATE('2003.07.23 10:04:28','YYYY.MM.DD
HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','Version Date','Recipe Header','5/18/2001 1:28:32
PM','','AREA1',' ',' ','','','','1','','','','','',' ','');
CALL BHInsert (TO_DATE('2003.07.23
10:04:28','YYYY.MM.DD HH24:MI:SS'),'BATCH_ID','1:CLS_FRENCHVANILLA-1','Author','Recipe Header','Mark
Shepard','','AREA1',' ',' ','','','','1','','','','','',' ','');
I've tried adding a line feed in addition to the space at the end of each call but that doesn't seem to help. Also have tried unsuccessfully to change the seperator used between each call using various valid continuation characters.
Executing multiple CALL statements from within Oracle's SQL Worksheet connecting as the same user and password, as my application executes successfully. However when I try this from within the Oracle ODBC test client, it fails with the same ORA-00911 error that I'm seeing in my application.
I'm currently trying the more recent ODBC drivers, however any ideas or suggestions would be greatly appreciated.Can you take the begin ... end block and run it using SQL*Plus?
I can't think of any documentation that would specifically answer this question. I'm sure if you read & absorbed the ODBC Programmers Reference (2000+ pages) you'd be able to find out, but I don't know of a quick way to find out.
You can enable SQL*Net tracing. There are a fair number of options for enabling this tracing-- http://tahiti.oracle.com has all the Oracle manuals online, which should give you enough info to configure exactly what you want.
I would suggest, however, that you look into more performant/ scalable alternatives rather than going too far down this path. A block with lots of SQL statements with literals isn't going to make your database happy even if you get it to work.
Justin -
How to execute multiple SQL statements thru frontend?
With SQL Server database, you can execute multiple SQL statements.
Ex.
SQLCommand cmd = new SQLCommand();
cmd.CommandText = "SELECT * FROM EMP; SELECT * FROM DEPT";
cmd.ExecuteXXX();
Note that for SQL Server, ";" (semocolon) is used as a separator.
What separator is required for Oracle ? Or rather, can I execute multiple SQL statements against Oracle database (10g) ?
(Why I want to do it is a totally diff. subject !)
Thanks,
Ami.Hello,
You could use an anonymous PL/SQL block to batch multiple statements.
If you want to use SELECT statements, you would open a REF CURSOR for each SELECT and return the REF CURSOR to your application. INSERT, UPDATE, and DELETE statements can just be passed as is.
A simple REF CURSOR example might look like:
begin
open :v_refcursor1 for select * from emp;
open :v_refcursor2 for select * from dept;
end;Where v_refcursor1 and v_refcursor2 are parameters defined as a REF CURSOR type.
Hope that helps a bit...
- Mark -
Extracting SQL statement from a Webi document's data provider using SDK.
Hi all,
Is it possible to extract the SQL statement from an existing Webi document's data provider using BO SDK? I've searched through the class library but haven't found any information on this yet. If you have done it, could you provide some guidance. Many thanks.I found the following Java code that might be of some help to you. I realize you are using .NET but this might push you down the right path.
The trick here is to use the Report Engine SDK to get the DataProvider of the DocumentInstance. Then, look at the SQLDataProvider to get your SQLContainer.
My apologies for the poor formatting. This didn't copy and paste over to the forums very well. I've cleaned up as much as I could.
<%@ page import="com.crystaldecisions.sdk.framework.*" %>
<%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.*" %>
<%@ page import="com.businessobjects.rebean.wi.*" %>
<%
boolean loginSuccessful = false;
IEnterpriseSession oEnterpriseSession = null;
String username = "username";
String password = "password";
String cmsname = "cms_name";
String authenticationType = "secEnterprise";
try
//Log in. oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( username, password, cmsname, authenticationType);
if (oEnterpriseSession == null)
out.print("<FONT COLOR=RED><B>Unable to login.</B></FONT>");
else
{ loginSuccessful = true;
catch (SDKException sdkEx)
{ out.print("<FONT COLOR=RED><B>ERROR ENCOUNTERED</B><BR>" + sdkEx + "</FONT>");}
if (loginSuccessful) { IInfoObject oInfoObject = null;
String docname = "WebI document name";
//Grab the InfoStore from the httpsession IInfoStore oInfoStore = (IInfoStore) oEnterpriseSession.getService("", "InfoStore"); //Query for the report object in the CMS. See the Developer Reference guide for more information the query language. String query = "SELECT TOP 1 * " + "FROM CI_INFOOBJECTS " + "WHERE SI_INSTANCE = 0 And SI_Kind = 'Webi' " + "AND SI_NAME='" + docname + "'";
IInfoObjects oInfoObjects = (IInfoObjects) oInfoStore.query(query);
if (oInfoObjects.size() > 0)
//Retrieve the latest instance of the report oInfoObject = (IInfoObject) oInfoObjects.get(0);
// Initialize the Report Engine ReportEngines oReportEngines = (ReportEngines)
oEnterpriseSession.getService("ReportEngines");
ReportEngine oReportEngine = (ReportEngine) oReportEngines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
// Openning the document DocumentInstance oDocumentInstance = oReportEngine.openDocument(oInfoObject.getID());
DataProvider oDataProvider = null;
SQLDataProvider oSQLDataProvider = null;
SQLContainer oSQLContainer_root = null;
SQLNode oSQLNode = null;
SQLSelectStatement oSQLSelectStatement = null;
String sqlStatement = null;
out.print("<TABLE BORDER=1>");
for (int i=0; i<oDocumentInstance.getDataProviders().getCount(); i++)
oDataProvider = oDocumentInstance.getDataProviders().getItem(i);
out.print("<TR><TD COLSPAN=2 BGCOLOR=KHAKI>Data Provider Name: " + oDataProvider.getName() + "</TD></TR>");
if (oDataProvider instanceof SQLDataProvider)
oSQLDataProvider = (SQLDataProvider) oDataProvider;
oSQLContainer_root = oSQLDataProvider.getSQLContainer();
if (oSQLContainer_root != null)
for (int j=0; j<oSQLContainer_root.getChildCount(); j++)
oSQLNode = (SQLNode) oSQLContainer_root.getChildAt(j);
oSQLSelectStatement = (SQLSelectStatement) oSQLNode;
sqlStatement = oSQLSelectStatement.getSQL();
out.print("<TR><TD>" + (j+1) + "</TD><TD>" + sqlStatement + "</TD></TR>");
else
out.print("<TR><TD COLSPAN=2>Data Provider is not a SQLDataProvider. SQL Statement can not be retrieved.</TD></TR>"); } } out.print("</TABLE>");
oDocumentInstance.closeDocument(); }
oEnterpriseSession.logoff();}%>
Maybe you are looking for
-
Unable to calcuate the ED for AED?
Hi, I have configured the Excise and able to calculate the BED and SED but system is not calculating the AED. I am using the Cal Type 364. Please suggest.... Thanks and Regards Nitin
-
Condition types in tax calculation procedures
hi sap Gurus, Tax calculation procedures cointains the order of steps, tax types{condition types}, and account keys.I am not able to understand what condition types are and its importance in the tax calculation procedures. Please help me SAP Gurus C.
-
Prefered vendor not displayed for shopping cart
Hi, We have PDP scenario, SC's originated from R/3 purchase requisitions, Issue details: 1. P.req was created with desired vendor and transfered to SRM and corresponding shopping cart is available in SOCO. 2. User created Held PO for corresponding SC
-
ABAP ER Switching to Business objects
Hi , I am ABAP technical Consultant with 5 yrs of Exp. I wanted know whether an ABAPER can swtich to Business Objects.Please help me to take a decision. Do we need to have any prerequisites for swtiching to BO.Please guide me. And If Yes, please let
-
Is it possible to remove a ContactEmployees using DI-API?
Hi: I need to remove from B1 database a lot of contact employees without remove the business partner, i checked out the DI-API reference and i noted that the ContactEmployees object not have a Remove method. Does exists any form of remove this objec