Problem with a Stored Procedure
I created a SP. My SP is:
Create or Replace Procedure sp_atualiza(val_ent in number,id_ent in integer)
as
begin
update venda set valor = val_ent*valor
where id_venda = id_ent;
end sp_atualiza;
Now into SQL*Plus I write:
SQL>execute sp_atualiza(1.5,3)
The message is: Procedure PL/SQL sucessfully(My windows is in Portuguese and I don't known to translate in english this message so well).
If i run into Home XE, this message is: Invalid SQL statement.
How can I do run a SP into Home and SQL*Plus of the XE?
Bom Dia!
EXECUTE is a SQL*Plus command - it doesn't work in most other tools (though some like TOAD do recognize it).
In a pure SQL tool, you need to provide a true SQL or PL/SQL statement:
BEGIN
SP_ATUALIZA(1.5, 3);
END;
/I hope that helps
Regards Nigel
Similar Messages
-
What is the problem with this Stored Procedure
Hi ,
What is the problem with this Stored Procedure ?Why is it giving errors ??
CREATE or replace PROCEDURE getEmpName
*(EMP_FIRST OUT VARCHAR2(255))*
BEGIN
SELECT ename INTO EMP_FIRST
FROM Emp
WHERE EMPNO = 7369;
END ;
*/*You don't specify precision in procedure arguments.
(EMP_FIRST OUT VARCHAR2(255))should be
(EMP_FIRST OUT VARCHAR2)Since you asked what's wrong with it, I could add that it needs formatting and the inconsistent use of upper and lower case is not helping readability. -
Performance problem with java stored procedure
hi,
i developped a java class, then I stored it in Oracle 8.1.7.
This class contains several import of other classes stored in the database.
It works, but the execution perfomances are disappointing. It's very long. I guess, that's because of the great number of classes to load that are necessary for my class execution.
I tried to increase the size of the java pool (I parameter 70 Mo in the java_pool_size parameter of the init.ora), but the performance is not much better.
Has anyone an idea to increase the performance of this execution of my class ?
In particular, is there a way to keep permanently in memory the java objects used by my class ?
Thanks in advance
bye
[email protected]
nullbefore running Java, the database session needs to be Java enabled; this might be the reason why it is taking so long. If this is the case, you should see an improvement in subsequent calls, once a database session is Java enabled, other users can benefit from it.
Kuassi
I have some performance issue with java stored procedure. Hope some one will be able to help me out. I'm using java stored procedures in my application and basically these procedures are used to do some validation and form the XML message of the database tables. I have noticed that when I call the PL/SQL wrapper function, it is taking time to load the java class and once the class is loaded the execution is faster. Most of the time is spent for loading the class rather than executing the function. if I reduce the class load time, I can improve the performance drastically. Do any one of you know how to reduce the class load time. The following are the platform and oracle version.
O/S: IBM AIX
Oracle: 8.1.7 -
Problem with a stored procedure to search in a table
h5.
Hi,
h5.
As many people on the forum, I'm new on PL/SQL programming.
h5.
I'm trying to program a stored procedure that allow to search on my table fields with different parameters.
h5.
All this parameters doesn't need to be set, at least one.
h5.
I'm looking for the solution from 2 weeks ago.
h5.
I have looked everywhere
h5.
Could someone help me, please??
h5.
Here is my code:
* HERE WE CREATE PACKAGE FOR THE CURSOR
create or replace
PACKAGE HOTEL_DEST_PKG
IS
/* Define the REF CURSOR type. */
TYPE HOTEL_DEST_TYPE IS REF CURSOR;
END HOTEL_DEST_PKG;
* HERE WE CREATE OUR STORE PROCEDURE TO SEARCH
create or replace
PROCEDURE Search_Hotel (
IdDocument IN number,
MyFilter IN VARCHAR2,
IdCountry IN number,
DepartureDateFirst IN DATE,
DepartureDateSecond IN DATE,
HD_Cursor OUT HOTEL_DEST_PKG.HOTEL_DEST_TYPE)
IS
SQL_REQ VARCHAR2(5000);
BEGIN
/* all columns were entered */
IF ((IdDocument > 0) OR
((MyFilter IS NOT NULL) AND (length(MyFilter) > 0)) OR
(IdCountry > 0) OR
(DepartureDateFirst IS NOT NULL) OR
(DepartureDateSecond IS NOT NULL))
THEN
SQL_REQ := 'SELECT HOTEL_DESTINATION.*
FROM HOTEL_DESTINATION
WHERE 1=1';
/* Search on the hotel id*/
IF IdDocument > 0 THEN
SQL_REQ := SQL_REQ || ' AND HOTEL_DESTINATION.HD_ID = :IdDocument';
ELSE
SQL_REQ := SQL_REQ || ' AND :IdDocument IS NULL';
END IF;
/*Search on different indexed fields*/
IF MyFilter IS NOT NULL AND LENGTH(MyFilter)>0 THEN
SQL_REQ := SQL_REQ || ' AND CONTAINS(HOTEL_DESTINATION.HD_FILTER, :MyFilter)';
ELSE
SQL_REQ := SQL_REQ || ' AND :MyFilter IS NULL';
END IF;
/* Search on the hotel country id*/
IF IdCountry > 0 THEN
SQL_REQ := SQL_REQ || ' AND HOTEL_DESTINATION.HD_CN_ID = :IdCountry';
ELSE
SQL_REQ := SQL_REQ || ' AND :IdCountry IS NULL';
END IF;
/* Search on the dates*/
IF DepartureDateFirst IS NOT NULL THEN
SQL_REQ := SQL_REQ || ' AND HOTEL_DESTINATION.HD_DEPARTURE_DATE >= :DepartureDateFirst';
ELSE
SQL_REQ := SQL_REQ || ' AND :DepartureDateFirst IS NULL' ;
END IF;
IF DepartureDateSecond IS NOT NULL THEN
SQL_REQ := SQL_REQ || ' AND HOTEL_DESTINATION.HD_DEPARTURE_DATE <= :DepartureDateSecond';
ELSE
SQL_REQ := SQL_REQ || ' AND :DepartureDateSecond IS NULL';
END IF;
OPEN HD_CURSOR FOR SQL_REQ USING IdDocument,
MyFilter,
IdCountry,
DepartureDateFirst,
DepartureDateSecond;
END IF;
END;
* HERE WE CALL AND EXECUTE OUR STORE PROCEDURE TO SEARCH
* ON WORD
set serveroutput on
DECLARE
IDDOCUMENT NUMBER;
MYFILTER VARCHAR2(200);
IDCOUNTRY NUMBER;
DEPARTUREDATEFIRST IN DATE;
DEPARTUREDATESECOND IN DATE;
HD_CURSOR OUT HOTEL_DEST_PKG.HOTEL_DEST_TYPE);
BEGIN
IDDOCUMENT := 0;
MYFILTER := 'test';
IDCOUNTRY := 0;
DEPARTUREDATEFIRST := NULL;
DEPARTUREDATESECOND := NULL;
SEARCH_HOTEL(
IDDOCUMENT => IDDOCUMENT,
MYFILTER => MYFILTER,
IDCOUNTRY => IDCOUNTRY,
DEPARTUREDATEFIRST => DEPARTUREDATEFIRST,
DEPARTUREDATESECOND => DEPARTUREDATESECOND,
HD_Cursor => HD_Cursor
-- Modify the code to output the variable
--DBMS_OUTPUT.PUT_LINE('HD_Cursor = ' || HD_Cursor);
END;You need to grant right on the table to the owner of the stored procedure directly (not via Role).
When there are only rights via role everything is fine in sql, but it will not work in stored procedures, functions or packages.
So as Table-Owner do:
grant select on <table> to <procedure, package or function-owner>;Edited by: hm on 22.10.2010 08:49 -
Problems with java stored procedure.
I have a java stored procedure that uses a package called RmiJdbc
which allows calling remote JDBC data sources from any java capable
machine.
I've loaded the RmiJdbc classes into oracle via the loadjava
command and everything seems to come up valid.
The stored procedure does a Class.forName() to get the driver
registered, than attempts to connect to the remote RMI driver.
The particular line it dies on is this (see the error below):
c = DriverManager.getConnection("jdbc:rmi:" + rmiHost + "/" + url);
A mangled version of this (minus the Oracle specific stuff) works
from the command line correctly. Can somebody point me in a
direction to figure out what's going on here?
THanks,
Eric
Oracle9i Enterprise Edition Release 9.0.1.3.0 - 64bit Production
With the Partitioning option
JServer Release 9.0.1.3.0 - Production
ORACLE_HOME = /oracle/v901ee
System name: HP-UX
Node name: athena
Release: B.11.00
Version: A
Machine: 9000/889
Instance name: PASDB2
Redo thread mounted by this instance: 1
Oracle process number: 13
Unix process pid: 7839, image: oracle@athena (TNS V1-V3)
*** SESSION ID:(8.547) 2002-08-15 15:41:27.221
java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
at sun.rmi.server.LoaderHandler$LoaderKey.<init>(LoaderHandler.java)
at sun.rmi.server.LoaderHandler.lookupLoader(LoaderHandler.java)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
at java.io.ObjectInputStream.inputArray(ObjectInputStream.java)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java)
at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java)
at sun.rmi.registry.RegistryImpl_Stub.lookup
at org.objectweb.rmijdbc.RJConnection.<init>(RJConnection:83)
at org.objectweb.rmijdbc.Driver.connect(Driver:135)
at java.sql.DriverManager.getConnection(DriverManager.java)
at java.sql.DriverManager.getConnection(DriverManager.java)
at TurnoverInfoPlusInterface.insertInterfaceRecords(TurnoverInfoPlusInterface:53)
java.sql.SQLException: Error unmarshaling return; nested exception is:
java.lang.NullPointerException
at org.objectweb.rmijdbc.Driver.connect(Driver:140)
at java.sql.DriverManager.getConnection(DriverManager.java)
at java.sql.DriverManager.getConnection(DriverManager.java)
at TurnoverInfoPlusInterface.insertInterfaceRecords(TurnoverInfoPlusInterface:53)More info...I'm also seeing "ORA-03113: end-of-file on communication channel". I checked the user trace file and didn't get much help...it indicated an "exception signal: 11" and core-dump type stuff that had no meaning to me.
-
Problem with JDBC stored procedure
Hi...
We are implementing an interface from SAP r/3 4.7 to Oracle DB 9.0. On sender side we have used IDOC Adapter and on Receiver side we have used JDBC Adapter.
Here we are using stored procedures in JDBC Adapter. I have 2 stored procedures(one for header and one for items) and SISCSO.SISCSO01 IDOC.
Here we are getting following error in RWB for JDBC Receiver adapter....
<b>Error</b>
" Receiver Adapter v2112 for Party '', Service 'BS_ORADEV':
Configured at 2006-08-16 10:12:14 GMT+05:30
History:
- 2006-08-16 11:02:04 GMT+05:30: Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. 'PR_SPARES_VOR_PO_HDR_UPLOAD' (structure 'statement'): java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00201: identifier 'PR_SPARES_VOR_PO_HDR_UPLOAD' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored ".
<b>My mapping file is like this.....</b>
<?xml version="1.0" encoding="UTF-8"?>
<ns0:TVS_MST_SPARES_ORDER xmlns:ns0="urn:tvsmotor:salesorder"><statement><PR_SPARES_VOR_PO_HDR_UPLOAD action="execute"><table>PR_SPARES_VOR_PO_HDR_UPLOAD</table><IN_DEALER_ID isInput="true" type="String">efde</IN_DEALER_ID><IN_SPARE_PO_NO isInput="TRUE" type="STRING">sdfsdf</IN_SPARE_PO_NO><IN_PO_DATE isInput="TRUE" type="STRING">12.12.2555</IN_PO_DATE><IN_ORDER_TYPE isInput="TRUE" type="STRING">23</IN_ORDER_TYPE><IN_REMARKS isInput="TRUE" type="STRING">Remark</IN_REMARKS><IN_SAP_SALE_ORD_NO isInput="TRUE" type="STRING">146546</IN_SAP_SALE_ORD_NO><IN_SAP_SALE_ORD_DT isInput="TRUE" type="STRING">12.12.2555</IN_SAP_SALE_ORD_DT><IN_TOT_VAL isInput="TRUE" type="STRING">2323</IN_TOT_VAL></PR_SPARES_VOR_PO_HDR_UPLOAD><PR_SPARES_VOR_PO_DTL_UPLOAD action="execute"><IN_DEALER_ID isInput="TRUE" type="STRING">efde</IN_DEALER_ID><IN_SPARE_PO_NO isInput="TRUE" type="STRING">sdfsdf</IN_SPARE_PO_NO><IN_PO_DATE isInput="TRUE" type="STRING">12.12.2555</IN_PO_DATE><IN_PART_NO isInput="TRUE" type="STRING">cfgdfw4w</IN_PART_NO><IN_ORDER_QTY isInput="TRUE" type="STRING">2</IN_ORDER_QTY><IN_PENDING_QTY isInput="TRUE" type="STRING">20</IN_PENDING_QTY><IN_RATE isInput="TRUE" type="STRING">2432</IN_RATE><IN_TAX isInput="TRUE" type="STRING">18</IN_TAX></PR_SPARES_VOR_PO_DTL_UPLOAD></statement></ns0:TVS_MST_SPARES_ORDER>
Please help me out with this error... tell me if more information is required.
Thanks,
Audumbar.hi mario,
tell me one thing.... does case metter for stored procedure name? and even for the parameters used in stored procedure?
i have changed the case of stored procedure name... (its small in Oracle) but have not changed the case of parameters....
after changing the case also i m getting the following error....
" Receiver Adapter v2112 for Party '', Service 'BS_ORADEV':
Configured at 2006-08-16 10:12:14 GMT+05:30
History:
- 2006-08-16 14:18:19 GMT+05:30: Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. <b>'pr_spares_vor_po_hdr_upload'</b> (structure 'statement'): java.sql.SQLException: ORA-06550: line 1, column 7:
PLS-00201: identifier <b>'PR_SPARES_VOR_PO_HDR_UPLOAD'</b> must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored "
Reply me as soon as possible.
Thanx,
Regards,
Audumbar
Message was edited by: Audumbar Pikle -
Dear Oracle Experts,
I try to use the stored procedure below but get this error :
"Error(4,1): PLS-00428: an INTO clause is expected in this SELECT statement"
I don't have any clue what could be wrong with my syntax. INTO wouldn't make any sense at this task.
Does someone of you know what's wrong with my Procedure ?
Hope someone can help,
best regards,
Daniel Wetzler
create or replace PROCEDURE AnalysisCompatibility (DATEBEGIN timestamp, DATEEND timestamp)
AS
BEGIN
select Fs.*,Vs.Analysispriority,Vs.Compatibility Compatibility from SigFacts Fs
inner Join Variables Vs On
(Fs.Var_Ref=Vs.Var_Ref and Fs.Machines_Ref=Vs.Machines_Ref )
where Fs.DT between DATEBEGIN and DATEEND
and
Vs.AnalysisPriority > 0
or
VS.Compatibility in (6,7,8,9,10,11,13,21,22)
order by Fs.DT,Fs.Machines_Ref desc, Vs.AnalysisPriority;
END AnalysisCompatibility;I have created a table (ATREPORT.TEST) that has has got the same column name and type of the query output and i still get error message
PLS-00403 -- statement ATreport.TESt cannot be used as an into target, pls help
DECLARE start_date DATE := to_date('01/09/2006' , 'DD-MON-YYYY');
end_date DATE := to_date('30/09/2006' , 'DD-MON-YYYY');
BEGIN
SELECT t.SEC_SHORT_NAME, t.SEC_ISIN, t.SEC_NO,t.SEC_NAME, t.TRADE_DATE,
t.PAYMENT_DATE,t.COUNTERPARTY, t.PRICE , t.NOMINAL ,
t.TRANSACTION_NO,t.CURRENT_VALUE_PC, t.CURRENT_VALUE_SC, t.PAYMENT_AMOUNT_PC,
t.PAYMENT_AMOUNT_SC,
ct.AMOUNT , ct.CURRENCY,
sb.BUSINESS_CLASS_LEVEL_2 ,sb.BUSINESS_CLASS_LEVEL_2_NAME,
sb.BUSINESS_CLASS_LEVEL_3 ,sb.BUSINESS_CLASS_LEVEL_3_NAME,
sb.BUSINESS_CLASS_LEVEL_4 ,sb.BUSINESS_CLASS_LEVEL_4_NAME,
sb.BUSINESS_CLASS_LEVEL_5 ,sb.BUSINESS_CLASS_LEVEL_5_NAME
INTO ATREPORT.TEST
from scdat.A_TRANSACTIONS t
INNER JOIN scdat.A_COSTTAX ct
ON ct.TRANS_REF = t.TRANS_REF
INNER JOIN scdat.A_SECS_BUSINESS_CLASS_TS sb
ON sb.SEC_REF = t.SEC_REF
where t.TRADE_DATE >= to_char(start_date ,'DD-MON-YYYY')
and t.TRADE_DATE < to_char(end_date ,'DD-MON-YYYY')
and ct.COST_NAME = 'Broker commission'
and sb.BUSINESS_CLASS_DEFINITION = 'FTSE';
END; -
Perfomance problem with java stored procedure
hi,
i developped a java class, then I stored it in Oracle 8.1.7.
This class contains several import of other classes stored in the database.
It works, but the execution perfomances are disappointing. It's very long. I guess, that's because of the great number of classes to load that are necessary for my class execution.
I tried to increase the size of the java pool (I parameter 70 Mo in the java_pool_size parameter of the init.ora), but the performance is not much better.
Has anyone an idea to increase the performance of this execution of my class ?
In particular, is there a way to keep permanently in memory the java objects used by my class ?
Thanks in advance
bye
[email protected]
nullHello again,
I read the documentation of 9i and found some hints about different TCP/IP socket handling of 9i and a standard JVM.
There are some parts that give hints but I couldn't find a sample code to show how to handle the differences.
Could anyone tell me how to handle the differences or give some links to sample code?
Thanks
Detlev -
Need Help With a Stored Procedure
Help With a Stored Procedure
Hi everyone.
I am quite new relative to creating stored procedures, so I anticipate that whatever help I could get here would be very much helpful.
Anyway, here is my case:
I have a table where I need to update some fields with values coming from other tables. The other tables, let us just name as tblRef1, tblRef2 and tblRef3. For clarity, let us name tblToUpdate as my table to update. tblToUpdate has the following fields.
PlanID
EmployeeIndicator
UpdatedBy
CreatedBy
tblRef1, tblRef2 and tblRef3 has the following fields:
UserName
EmpIndicator
UserID
In my stored procedure, I need to perform the following:
1. Check each row in the tblToUpdate table. Get the CreatedBy value and compare the same to the UserName and UserID field of tblRef1. If no value exists in tblRef1, I then proceed to check if the value exists in the same fields in tblRef2 and tblRef3.
2. If the value is found, then I would update the EmployeeIndicator field in tblToUpdate with the value found on either tblRef1, tblRef2 or tblRef3.
I am having some trouble writing the stored procedure to accomplish this. So far, I have written is the following:
CREATE OR REPLACE PROCEDURE Proc_Upd IS v_rec NUMBER;
v_plan_no tblToUpdate.PLANID%TYPE;
v_ref_ind tblToUpdate.EMPLOYEEINDICATOR%TYPE;
v_update_user tblToUpdate.UPDATEDBY%TYPE;
v_created_by tblToUpdate.CREATEDBY%TYPE;
v_correct_ref_ind tblToUpdate.EMPLOYEEIDICATOR%TYPE;
CURSOR cur_plan IS SELECT PlanID, EmployeeIndicator, UPPER(UpdatedBy), UPPER(CreatedBy) FROM tblToUpdate;
BEGIN
Open cur_plan;
LOOP
FETCH cur_plan INTO v_plan_no, v_ref_ind, v_update_user, v_created_by;
EXIT WHEN cur_plan%NOTFOUND;
BEGIN
-- Check if v_created_by has value.
IF v_created_by IS NOT NULL THEN
-- Get the EmpIndicator from the tblRef1, tblRef2 or tblRef3 based on CreatedBy
SELECT UPPER(EmpIndicator)
INTO v_correct_ref_ind
FROM tblRef1
WHERE UPPER(USERNAME) = v_created_by
OR UPPER(USERID) = v_created_by;
IF v_correct_ref_ind IS NOT NULL THEN
-- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
ELSIF
-- Check the Other tables here????
END IF;
ELSIF v_created_by IS NULL THEN
-- Get the EmpIndicator based on the UpdatedBy
SELECT UPPER(EmpIndicator)
INTO v_correct_ref_ind
FROM tblRef1
WHERE UPPER(USERNAME) = v_update_user
OR UPPER(USERID) = v_created_by;
IF v_correct_ref_ind IS NOT NULL THEN
-- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
ELSIF
-- Check the Other tables here????
END IF;
END IF;
END;
END LOOP;
CLOSE cur_plan;
COMMIT;
END
Please take note that the values in the column tblToUpdate.UpdatedBy or tblToUpdate.CreatedBy could match either the UserName or the UserID of the table tblRef1, tblRef2, or tblRef3.
Kindly provide more insight. When I try to execute the procedure above, I get a DATA NOT FOUND ERROR.
Thanks.Ah, ok; I got the updates the wrong way round then.
BluShadow's single update sounds like what you need then.
I also suggest you read this AskTom link to help you see why you should choose to write DML statements before choosing to write cursor + loops.
In general, when you're being asked to update / insert / delete rows into a table or several tables, your first reaction should be: "Can I do this in SQL?" If you can, then putting it into a stored procedure is usually just a case of putting the sql statement inside the procedure header/footers - can't really get much more simple than that! *{;-) -
How to verify the user information pass by the form with a stored procedure?
Hi,
I would like to know how to verify user information pass by the form with a stored procedure.
I want make a portal which accepts to new user registration, but I want verify the new user's informations (like the name don't contain a number etc).
Thanks for your help
regards
jlaHi Samson,
You can use the UI API to do this. You can catch the form_ADD event and then validate the input from the users. You can even block the event from completing (and stop the document from being added) if your code finds some incorrect data using the bubbleEvent functionality.
I don't have one specific example to show you, but if you look at some of the SDK samples (for example C:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\02.CatchingEvents) to see how to work with events, you can then create your own validation to ensure the users data is valid.
Regards,
Niall -
How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every so
many hours.How big is the table on server B? Is that possible to bring the all data into a server A and merge the data locally?
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every so many hours.
Hello,
If you had configure server2 as
linked server on the server1, you can run the following statement inside stored proceduce to copy table data. And then create a job to the run stored proceduce every 4 hours.
Insert Into Server2.Database2.dbo.Table2
(Cols)
Select Cols From Server1.Database1.dbo.Table1
Or you can use the SQL Server Import and Export Wizard to export the data from server1 to server2, save the SSIS package created by the wizard on the SQL Server, create a job to run the SSIS package.
Reference:http://technet.microsoft.com/en-us/library/ms141209.aspx
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
Problem Calling MaxDB stored procedure with output from MII Query template
Hi,
I am using Max DB Database studio to write stored procedure, I am calling stored procedure from MII Query using CALL statement.
Can anyone guide me how to pass output values of stored procedure.
Examlpe::
call ProcName('[Param.1]','[Param.2]','[Param.3]','[Param.4]','[Param.5]', :isSuccess, :Trace)
In the above line of code I am not able to get the output values of stored procedure that is isSuccess and Trace values in Query template when executed. But same thing I get when executed in Database studio.
How do I call with outputs for any stored procedure in MII.
Any help would be appriciated.
Thanks,
PadmaMy call statement is like this
call RESULTDATA_INSERT('[Param.1]','[Param.2]','[Param.3]', :isSuccess, :Trace)
I am able to insert record in DB, But I am not getting output values in Query template.I have done this in Fixed Query, when I execute it throws me "Fatal error as Loaded content empty".
I tried giving select below call but it dont work.
Regards,
Rao -
Problem using Null as a parameter with a stored procedure
Hello All,
We're are having an issue with a Crystal Report using a Stored procedure.
The procedure has been created to be able to hande the null value as an input. When generating the report within the Crystal designer everything works when selecting the null checkbox. The reports is doing what is to be expected.
When using a Java program to generate this report we receive a JavaException
Caused by: java.lang.IllegalArgumentException: Invalid argument type
at com.crystaldecisions.sdk.plugin.desktop.common.internal.w.setValue(Unknown Source)
Any idea if something specific/different needs to be done whenb comparing this to regular generation of reporting within a Java application.
Kind RegardsYou will need to convert your table into an IProcedure object. This will allow you to pass parameters directly to your stored procedure.
Try something like this:
if(table instanceof com.crystaldecisions.sdk.occa.report.data.Procedure)
IProcedure command = (IProcedure)table;
Fields parameterFields = (Fields)command.getParameters();
ParameterField commandParam = (ParameterField)parameterFields.get(0);
Values values = new Values();
ParameterFieldDiscreteValue pfdv = new ParameterFieldDiscreteValue();
pfdv.setValue(new Integer(1));
values.add(pfdv);
commandParam.setCurrentValues(values); -
Problem of java stored procedure
hi,
now I use the oracle9i JDeveloper9.0.3.1 to develop java stored procedure and then publish it to oracle9i database.
In the database I create PL/SQL procedure to invoke the java stored procedure.But I encounter the problem,that is ,when I run the PL/SQL procedure ,it throw the java.lang.NullPointerException ,while the java class,the java stored procedure can run correctly invoked by the main class of java.The code of the java stored procedure is as follows:
import java.sql.*;
import java.util.Properties;
public class SQLServerEventDistribute
public static void sqlServerSaveData(String hostName,String databaseName,String user,String password,String tableName,int x1,int y1,int x2,int y2,String ip)
String url="",sql="",userName="",passwd="";
Connection connection;
Statement statement;
url="jdbc:microsoft:sqlserver://"+hostName+":1433;DatabaseName="+databaseName+";User="+user+";Password="+password;
sql="INSERT INTO "+tableName+" VALUES("+x1+","+y1+","+x2+","+y2+",'"+ip+"')";
Properties property=new Properties();
property.setProperty(userName,user);
property.setProperty(passwd,password);
try
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
// DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.SQLServerDriver());
connection=DriverManager.getConnection(url,property);
statement=connection.createStatement();
statement.execute(sql);
}catch(ClassNotFoundException connectSQLServerEx)
System.out.println(connectSQLServerEx.getMessage());
catch(SQLException connectSQLServerEx)
System.out.println(connectSQLServerEx.getMessage()+connectSQLServerEx.getErrorCode());
the main class is as follows:
public class Test
public static void main(String[] args)
SQLServerEventDistribute.sqlServerSaveData("gsm","gsmd","sa","sa","IPBinding",11,45,24,21,"23.1.248.12");
and the PL/SQL procedure is as follows:
PROCEDURE TEST AS
BEGIN
SQLSERVERSAVEDATA('gsm','gsmd','sa','sa','IPBinding',11,45,24,21,'23.1.248.22');
END;
How can I deal with it?
can you tell me?
thanksHi JavaQQ,
This is just a guess, but I think you need to load the
Micro$oft SQLServer JDBC driver into the Oracle
database (using the "loadjava" utility).
In any case, there are several ways -- apart from JDBC
-- for accessing a different database from within an
Oracle database. Have you tried searching the Oracle
Web sites for suitable products?
Hope this helps.
Good Luck,
Avi.abramia ,thank you very much.
but I have load the Microsoft SQLServer JDBC driver into the Oracle database .
When I debugged the PL/SQL procedure,the exception was thrown at line connection=DriverManager.getConnection(url,property);
What's the problem with it?
Maybe you are looking for
-
How do I hide the blank week between months on the iOS calendar app?
I keep double booking appointments near the end of each month because it appears (at a glance) that next week is open and available. How can I get the app to hide (not show) a blank week between each month? Thank you.
-
How do I hook up external speaker to macbook pro
How do I hook up external speaker to macbook pro?
-
Why does my husbands older iPad connect to outside wifi and mine won't even though it is newer?
-
HI all, I would like to restrict the creation of multiple RFQ's with reference to the Purchase requisition for the same vendor. I can get it by ABAP development, but curious to know whether we can acheive the same with standard configuration???? Pl
-
now my iphone is 3GS 32GB and now it is version 4.1 and i make an update to 6.01 and the update is installed but there is an error saying that the activation server is temporarily unavailable and saying try connecting to itunes and to activate and i