Benefit of using store procedure instead of select statement to pull data into biztalk
I was wondering why store procedure is more beneficial than using select statement to pull data into biztalk?
In addition to the above two points, in case if there is a change in logic of stored procedure, you only need to modify the stored proc and the applications calling/using it may be left intact.
Also, stored procedures are complied code so performance is better and safe too.
Thanks,
Prashant
Please mark this post accordingly if it answers your query or is helpful.
Similar Messages
-
Use of a stored procedure in a select statement submitted to cx_oracle
Hi,
I am developping under python and I'm using the cx_oracle interface.
I've written a stored procedure that I've tested directly under sqlplus session : it's ok. I've also tested this stored procedure from python by using callproc routine : its also ok.
Now I need to use this procedure within a select statement that I submit to the execute statement of cx_oracle as :
s = "select a.airport_name,gmlpos.ExpLatLong(a.point_name) from airport"
self.db = oracledb('ops/opeope00@ACE2008B')
dbmsg = self.db.execute(s)
IF (dbmsg == "") :
An error occurs :
Message = request = select a.AIRPORT_NAME, gmlpos.ExpLatLong(a.point_name) from airport, errmsg = ORA-00904: "GMLPOS"."EXPLATLONG": invalid identifier
Noting that the execution of any other select (without stored procedure) order from python works fine.
Is anybody has a solution or workaround ?
thanks a lot for your helpThe result gives what is expected :
AIRP
GMLPOS.EXPLATLONG(A.POINT_NAME)
LFLL
-45.71666666666667 -5.08333333333333
As I said the stored procedure works fine.
Thanks for your expertise
PS : why change the login password until nobody says which machine or database is concerned ? -
Which is better to use Store Procedure or Views in Crystal Reports ?
Hi,
which one is more better to use Store Procedure or Views in Crystal Reports ?
Thanks.It depeneds on the requirement. Well, but from performance point of view as u know that stored procedures are already compiled on DB side, they would be more efficient. Views are handled differently. Here CR has nothing to do with it.
But if the stored procedure u r using is having 2 Select statements, CR will only display the results from the first select statement. In that case you need to use Views as one can use more than one views in the report and join them.
Using a Generic view which is created by the DBA for a larger audience will result in performance issues meaning if a View "V" has 25 fields and View is based on 5 tables and ur report is using only 5 fields which are coming only from 2 tables inside the view,in this case u will end up in joining 3 more tables unnecessarily.
Hope this helps! -
Need to update multiple records using store procedure
Hi i am trying to update multiple records using store procedure but failed to achieve pls help me with this
for example my source is
emp_name sal
abhi 2000
arti 1500
priya 1700
i want to increase salary of emp whose salary is less than 2000 it means rest two salary should get update..using stored procedure only
i have tried following code
create or replace procedure upt_sal(p_sal out emp.sal%type, p_cursor out sys_refcursor)
is
begin
open p_cursor for
select sal into p_sal from emp;
if sal<2000 then
update emp set sal= sal+200;
end i;f
end;
and i have called the procedure using following codes
set serveroutput on
declare
p_sal emp.sal%type;
v_cursor sys_refcursor;
begin
upt_sal(p_sal,v_cursor);
fetch v_cursor into p_sal;
dbms_output.put_line(p_sal);
end;
the program is executing but i should get o/p like this after updating
1700
1900
but i am getting first row only
2000
and record is not upsating...please help me with this
thanksHi Alberto,
thanx for your valuable suggestion. but still i have doubt. the code which i have mentioned above might be simple but what if i have big requirement where i need update the data by using loops and conditional statement.
and i have similar kind of requirement where i need to deal with procedure which returns more than one row
my source is
empno ename salary
111,abhi,300
112,arti,200
111,naveen,600
here i need to write a store procedure which accepts the empno (111) as input para and display ename and salary
here i have written store procedure like this
create or replace procedure show_emp_det(p_empno in emp.empno%type, p_ename out emp.ename%type,p_salary out emp.salary%type, p_cursor out sys_refcursor)
is
begin
open p_cursor for
select ename,salary into p_ename,p_salary from emp where empno=p_empno;
end;
and i have called this by using
declare
p_salary emp.salary%type;
p_ename emp.ename%type
v_cursor sys_refcursor;
begin
show_emp_det(111,p_ename,p_salary,v_cursor);
fetch v_cursor into p_ename,p_salary;
dbms_output.put_line(p_ename);
dbms_output.put_line(p_salary);
end;
here i should get
abhi,300
naveen,600
but i am getting first row only
abhi,300
but i want to fetch both rows...pls help me to find the solution -
How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000
Post Author: ltkin
CA Forum: WebIntelligence Reporting
Hi,
How to build a report in web Intelligence using Store procedure under Microsoft SQL Server 2000 ?
Regards,Hi ltkin,
Unfortunately, it is not possible in Xir2 to create Webi reports from stored procedures.
Webi reports can only be created from Universe. So in Business Objects XIR3 we can create a special universe that enables Web Intelligence user's to access stored procedures residing in the database. This is the only way that Web Intelligence user's can access stored procedures.
Please let me know if the above information helps.
Regards,
Pavan -
How to pass xml data as objects into Database using store procedures
Hi All,
I don't have much knowledge on store procedure,can anybody help how to pass the xml as objects in Database using store procedure.
My Requirement is I have a table with three fields EMPLOYEE is table name and the fields are EMP_ID,EMP_TYPE AND EMP_DET,I have to insert the employees xml data into corresponding fields in the table.
Input Data
<ROWSET>
<ROW>
<EMP_ID>7000</EMP_ID>
<EMP_TYPE>TYPE1</EMP_TYPE>
<EMP_DET>DEP</EMP_DET>
<ROW>
<ROW>
<EMP_ID>7000</EMP_ID>
<EMP_TYPE>TYPE2</EMP_TYPE>
<EMP_DET>DEP2</EMP_DET>
<ROW>
<ROW>
<EMP_ID>7000</EMP_ID>
<EMP_TYPE>TYPE3</EMP_TYPE>
<EMP_DET>DEP3</EMP_DET>
<ROW>
<ROWSET>
So each row values has to inserted into resp fields in the table.
Regards
ManiDo you have a similar structure in your stored procedure ?
In that case you can simply call the procedure from soa using db adapter and do a mapping to assign the values. -
Use of cursors insted of select statements
could any one please explain what is the advantage of using cursors instead of simple select statements
thanks
sibyA benefit to using an explicit cursor rather than a select statement, is for the NO_DATA_FOUND exception. Its kind of like a free IF statment. IF no data is found, then stop.
if you write a select statement, and no data is returned, you SHOULD code for the NO_DATA_FOUND exception. Often people say, "i'll ALWAYS get a row returned". but you should always cover your code "just in case". so you must code an exception...
declare
v_var varchar2(1);
procedure do_something(p_parm varchar2) is
begin
null;
end do_something;
procedure log_error is
begin
null;
end log_error;
begin <<main>>
do_something('x');
begin <<selectblock>>
select dummy
into v_var
from dual
where dummy = 'a';
do_something(v_var);
exception
when no_data_found then
log_error;
end selectblock;
do_something (v_var||'abc');
end main;
if you use an explicit cursor instead, you don't need to code for the NO_DATA_FOUND. If an explicit cursor opens and finds no rows, there are simply no rows. of course, you don't need a loop if you expect only 1 row returned under normal circumstances.
BTW, don' forget that SQL%ROWCOUNT and your_cursor%ROWCOUNT are not initialized. There is a null, until a row is successfully fetched. therefore if no rows are returned at all, %ROWCOUNT is NULL.
declare
v_var varchar2(1);
cursor my_cur is
select dummy
from dual
where dummy = 'a';
procedure do_something(p_parm varchar2) is
begin
null;
end do_something;
procedure log_error is
begin
null;
end log_error;
begin << main>>
for cur_rec in my_cur loop
dbms_output.put_line('inside');
begin <<loop_block>>
if nvl(my_cur%rowcount,0) > 1 then
do_something(cur_rec.dummy);
else
log_error;
end if;
end loop_block;
end loop;
end main;
/ -
Can we call a stored procedure in a select statement
Hi All
I want to call a stored procedure inside a select statement is this possible.
Regards
SravzYou can create a pipelined function which gathers the data from your stored procedure and then use that in a select statement or directly write your script in any function or pipelined function. ;)
There is no way you can call any stored procedure in a SELECT statement directly - i guess.
Regards.
Satyaki De. -
Using pop-up value in select statement
Hello.
I want to select a value from a pop-up box and then use that value in a select statement for another pop-up. Is that possible?
The first pop-up is P39_PIIN_CALL but it is not recognized in the second pop-up when I use it in the select statemnt... select * from table where PIIN = :P39_PIIN_CALL. I get nothing back because it has no idea what :P39_PIIN_CALL is. I'm desperate and on a timeline.
Thanks,
Mark EHi,
After fetching the value from first popup the page should submit so that the value is availble to the second popup..
Edit the first popup.. and in HTML Form Element Attributes and enter onchange="doSubmit('MyRequest')"
Regards,
Shijesh -
Limitations in using a function within a select statement
I have a function which retrieves various data elements from the
database and formats it accordingly. The data (varchar2)
returned could be in excess of 2,000 characters length.
I need to use the returned data as part of a view. I am able to
use the function in a "select" statement, but when I use it with
returned data in excess of 2,000 chars, I get the following
error:
ORA-06502: PL/SQL: numeric or value error
This error is occurring whenever the returned data is in excess
of 2,000 characters.
Is there an alternative method to what I am proposing, I have
tried alternative data types but if I am able to use it in a
"select" statement, I get the above error when the returned
length exceeds 2,000 chars.
Thanks
Peterare u using oracle 7. varchar2 limit in 8 is 4000.
-
Insert and update same record of table using store procedure in oracle 10g
Hi,
I am using oracle sql developer for this.
I have created Store procedure which run after every 30mins of interval.
the problem is Ii need to insert data for first time of day then later that same record should update for particular field(here its plan code).
if new field is coming (if new plan code is generated) then it should insert data and again update same for interval.
means for each plan individual record(i.e. plan wise summary) should be there for only a day. next day new record for same plan.Hi,
You should use Merge like shown below:-
Merge into original_table a
using second_table b
on (a.primary_key=b.primary_key and a.primary_key........)
when match then
update set column_list=b.column_list
when not match then
isert into (column list)
values(a.column_list)If you dont know much about merge then follow below link..
http://www.oracle-developer.net/display.php?id=203
http://www.oracle-base.com/articles/10g/merge-enhancements-10g.php -
Using store procedures with SQLJ - please help!
I have two questions:
1.I wrote simple test appllication that uses SQLJ to run store
procedures from SQL package. It compiles and work fine from
JDeveloper 3 if I use java version JDK1.2.2_JDeveloper.
It compiles OK in regular JDK1.2.2 but raise the following
exception when running:
profile
com.itrade.trserver.truser.dbqueries.ItrHistorian_SJProfile0 not
found: java.io.InvalidClassException: [Ljava.lang.Object;;
Serializable is incompatible with Externalizable
Does it mean that I have to use JDeveloper JDK?
2.When I give other then default package for *.sqlj file the
*.sqlj file is added to project but I cannot see it in specified
package (the *.sqlj file is created in the its directory).
After I compile the project the I can see *.java file in the
specified package, but compiler gives errors about redefined
symbols. If I remove *.sqlj file from the project it compiles OK.
What I am doing wrong?
Yakov Becker
nullThank you for the response.
I don't create jar file. I run it from JDeveloper environment.
What do you mean by "I made sure to also copy over the
: the .ser file"? What purpose of the *.ser file in this case?
Yakov
JDeveloper Team (guest) wrote:
: I have come across this error before..
: I'm assuming that your jar file is in the classpath as
: specified in the Jserv configuration?
: When I had the error, I made sure to also copy over the
: the .ser file.
: In my case, I happened to have both my class files and
: the .ser file outside of a jar file and it worked..
: Hope this helps!
: Yakov Becker (guest) wrote:
: : I have two questions:
: : 1.I wrote simple test appllication that uses SQLJ to run
store
: : procedures from SQL package. It compiles and work fine from
: : JDeveloper 3 if I use java version JDK1.2.2_JDeveloper.
: : It compiles OK in regular JDK1.2.2 but raise the following
: : exception when running:
: : profile
: : com.itrade.trserver.truser.dbqueries.ItrHistorian_SJProfile0
: not
: : found: java.io.InvalidClassException: [Ljava.lang.Object;;
: : Serializable is incompatible with Externalizable
: : Does it mean that I have to use JDeveloper JDK?
: : 2.When I give other then default package for *.sqlj file the
: : *.sqlj file is added to project but I cannot see it in
: specified
: : package (the *.sqlj file is created in the its directory).
: : After I compile the project the I can see *.java file in the
: : specified package, but compiler gives errors about redefined
: : symbols. If I remove *.sqlj file from the project it
compiles
: OK.
: : What I am doing wrong?
: : Yakov Becker
null -
hello, we need to remove the dirty data from MDS, but we found we can only do this from MDS web, and we need to do this by store procedure to make this process automatically. is there any easy method to remove the data from MDS automatically? thank.
WarrenHi Warren,
Assuming the dirty data is easily identifiable, all you need to do is use the staging process with import type of 5 (de-activate - i.e., soft delete) or import type of 6 (hard delete).
Could give more details if I knew the version of MDS you are running (SQL 2008R2 or SQL 2012).
Kind regards,
M -
Using Store Procedures with BC4J - Help
I need some help, could you explain me how to call some store procedures on an Entity Object with a source code.
I really apreciate your help.
nullYou can override the doDML method.
Then I get the connection using the getDBTransaction() method.
After that you can include your code in order to invoke the stored procedure.
Example:
public void doDML(int operation, TransactionEvent e) {
CallableStatement stmt = null;
if (operation == DML_INSERT)
// Prepare JDBC CallableStatement with the Stored Procedure Call
String plStr = "XXXXXX";
stmt = getDBTransaction().createCallableStatement(plStr , 1);
Other way:
Create a method in the view objet and make it a client method.
You can get the appmodule and the DBTransaction in this method.
In both cases you are using the same connection. -
I am trying to make a ssis package that get the data calling the store proc with two param one is ID and other is Sys_refcursor. Say Store Proc as ListName(Id int, myCur sys_refcursor), which gets the datas with the conditions inside it.
REATE OR REPLACE PROCEDURE schemaName.LISTNAME (P_ID IN INT, LST_NAME_REFCUR IN OUT SYS_REFCURSOR)
IS
P_NAMESOURCE_ID INT;
BEGIN
SELECT SOURCE_ID INTO P_NAMESOURCE_ID FROM SEARCHING_TABLE ST WHERE ST.ID = P_ID;
IF (P_NAMESOURCE_ID=1)
THEN
OPEN LST_SOURCE_REFCUR FOR
SELECT ST.ID,
ST.TRANSACTION_DATE AS TRAN_DATE,
IF (P_NAMESOURCE_ID=1)
THEN
OPEN LST_SOURCE_REFCUR FOR ....
then i need to get the data from that refcursor and fetch those data to excel sheet to a virtual directory.
Any help would be appreciated. I am new to SSIS. and i need to do this assignment this friday.Hi 11srk,
To fetch data from Oracle store procedure, you can use a Script Component as source to call the Oracle stored procedure by using System.Data.OracleClient OracleDataReader, and get the rows and add them to the pipeline buffer. For more information, please
see:
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/1d0b3a1b-8792-469c-b0d1-f2fbb9e9ff20/dump-oracle-ref-cursor-into-ms-sql-staging-table-using-ssis
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/fcdaa97e-8415-4c3e-8ffd-1ad45b590d57/executing-an-oracle-stored-procedure-from-ssis?forum=sqlintegrationservices
http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracledatareader(VS.90).aspx
Regards,
Mike Yin
TechNet Community Support
Maybe you are looking for
-
How to send an email with attachment using shareponit 2013
Hi Team, I have a PowerView report in my PowerPivot gallery and I want to export it to a PDF file then email it to id. Also I need this to be scheduled. Kindly suggest on the steps! Thanks in Advance!! Thanks, Arsath.
-
How to create editable PDF template for XML Publisher reports
Hi, I have got a requirement to have some editable fields in one report whose output is in PDF format. I tried looking and saw this can be done using the XML Publisher report and using PDF template. But I got only Adobe Acrobat Reader and it does not
-
Why is my ipad screen coming on in black and white?
why is my ipad screen coming on in black and white?
-
City of origin need to be recorded for PO - and reports required?
Hi all, My client is requiring city of origin report with respect to PO, can you suggest me through which reports we can get city of origin with respect to PO regards, Sanju
-
First Post - Quick Question re: 20" Display
I'm new to Apple - just switched about a month ago and wish I had jumped sooner. Bought a new powerbook and 20" Cinema Display. You know those little things that drive you nuts - we'll I've got one of them. The display almost sounds like it's clickin