OBIEE execute stored procedure to load tables before running report
Hi..
I want to execute a stored procedure to load database tables before running a report in OBIEE .
I need to pass 2 parameters to the stored procedure which loads into tables.
In the Connection Pool --> Connection Script Tab --> Execute before query, I wrote the below query using the repository variables VAR1 & VAR2 to execute the
DECLARE VAR1 number; VAR2 number;
BEGIN
schema_name.package_name1.package_body('VALUE OF(VAR1)', 'VALUE OF(VAR2)'); COMMIT;
schema_name.package_name2.package_body('VALUE OF(VAR1)', 'VALUE OF(VAR2)'); COMMIT;
END;
I am receiving the following error to declare the schema_name.package_name
+++Administrator:2a0000:2a0004:----2010/06/21 14:29:00
-------------------- Sending query to database named ACBS-OCC (id: <<49419>>):
BEGIN schema_name.package_name1.package_body1('VALUE OF(VAR1', 'VALUE OF(VAR2'); COMMIT; schema_name.package_name2.package_body2('VALUE OF(VAR1)', 'VALUE OF(VAR2)'); COMMIT;END;
+++Administrator:2a0000:2a0004:----2010/06/21 14:29:00
-------------------- Query Status: Query Failed: [nQSError: 16001] ODBC error state: S1000 code: 6550 message: [Oracle][ODBC][Ora]ORA-06550: line 1, column 7:
PLS-00201: identifier 'SCHEMA_NAME.PACKAGE_NAME1' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06550: line 1, column 93:
PLS-00201: identifier 'SCHEMA_NAME.PACKAGE_NAME2' must be declared
ORA-06550: line 1, column 93:
PL/SQL: Statement ignored.
[nQSError: 16015] SQL statement execution failed.
Please suggest how to declare and execute the stored procedure.
Thanks in advance.
Hi,
I know that any Function / Procedure needs to be called using a EVALUATE function in OBIEE.
Thanks,
Vijay
Similar Messages
-
How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
Hi
I have a stored procedure. It can be executed like this
exec test @p = 1;
exec test @p = 2
exec test @p = n;
n can be hundred.
I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time.
If I know the number in advance, say 3, I can create 3 different Execution SQL Tasks. They can be run in parallel.
However, the n is not static. It is coming from a table.
How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
I think about using script task. In the script, I get the value of n, and the list of p, from the table, then running a loop with. In the loop, I create a threat and in the threat, I execute the sp like : exec test @p = p. So the exec test may
be run parallel. But I am not sure if it works.
Any idea is really appreciated.Hi nam_man,
According to your description, you want to call stored procedures in parallel, right?
In SSIS, we can create separate jobs with different stored procedures, then set the same schedule to kick the jobs off at the same time. In this way, we should be careful to monitor blocking and deadlocking depending on what the jobs are doing.
We can also put all stored procedures in SSIS Sequence container, then they will be run in parallel.
For more information about SSIS job and Sequence container, please refer to the following documents:
http://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/
https://msdn.microsoft.com/en-us/library/ms139855(v=sql.110).aspx
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
Stored procedure accessing system table
I am using a stored procedure to access tables in other schemas. I pass the schema and table name as parameters to the stored procedure. I use these two variables to create a cursor of column names from all_tab_columns table. When I access all_tab_columns from SQL Plus, the right result is returned. When the procedure executes the same select statement in the same schema and using the same search criteria, the table I am looking for can not be found.
Example:
select count(column_name) from all_tab_columns where owner = 'MYADM' and table_name = 'MYTABLE';
This will return the correct number of columns when executed in SQL Plus.
cursor mycursor is
select count(column_name) from all_tab_columns where owner = p_owner and table_name = p_table;
This cursor, when used in my stored procedure, finds nothing when p_owner is set to MYADM and p_table is set to MYTABLE.
I've tried granting all permissions to the calling schema with no positive results. I am aware that the calling schema is not required to have the necessary privileges when a procedure accesses data in other schemas. So I don't understand what the problem is. I greatly appreciate anyone's help.
CyrusHi,
try this, probaly this'll give you the desired output :
Procedure Column_cnt
( p_owner IN varchar2,
p_table IN varchar2 ) IS
cursor c1 is
select count(column_name) col_cnt from all_tab_columns where owner = upper(p_owner)
and table_name = upper(p_table);
BEGIN
for i in c1 loop
dbms_output.put_line(i.col_cnt);
end loop;
END;
Now from SQLPLUS type :
exec column_cnt('OWNER','TABLE_NAME')
Note: parameters are in Varchar2, so they should be within quotes.
But do you really want a cursor to store a single row, single column value, cursors are for fetching multiple rows/columns that means for a result set.
if you want to get only count(column_name) then you could re-write the procedure like this way :
Procedure Column_cnt
( p_owner IN varchar2,
p_table IN varchar2 ) IS
col_cnt number;
BEGIN
select count(column_name) into col_cnt from all_tab_columns where owner = upper(p_owner)and table_name = upper(p_table);
dbms_output.put_line(i.col_cnt);
END;
Thanks
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by cyrus eslami ([email protected]):
I am compiling and invoking the procedure in a schema that has the correct privileges granted to it.
-Cyrus<HR></BLOCKQUOTE>
null -
Crystal Web Viewer executing stored procedure when going to next/prev page
We are using VS.NET 2005 with SP1 to design reports and embed them in an aspnet web app. Some of them take a while to run, even in the designer. In the designer, however, next page and print operations are speedy. In the web viewer, next page and print operations are agonizingly slow.
Viewing page 2 of a report seems to take about as long as viewing page
1. After running SQL Profiler to trace the report, it is apparent that the entire report (Stored Procedure Call) is being re-run and just page 2 is being sent to the browser.
Is this right?
Shouldn't the report document be stored on the server or event the client so that the desired page can be loaded without having to hit the database again??
We are using Business Objects Crystal Reports XI Release 2
Do you have a sample code on this issue.It still did not work. As you see my code has the Not Page.IsPostBack. It still goes to the database to run the stored procedure over and over again.
Do an example with more than 100 records to have multiple pages. After you go to page #2, change your data by updating one of your fields that will not fit the criteria you are looking for. In this example I changed the strPeriod from 1 to 2 and it gives you a blank report.
update PeriodTable
set fieldPeriod = 2
< h3>Here is the code:</h3>
Imports System.Xml
Imports System.data
Imports System.IO
Imports System.Text
Imports System.Configuration
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Partial Public Class viewreport
Inherits System.Web.UI.Page
Private _dsContacts As DataSet
Dim strUser, strReport, strPeriod, strRegionType, strRegion, strDate, strUnit As String
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Try
If Not Page.IsPostBack Then
If Not Page.User.Identity.IsAuthenticated Then
Response.Redirect("default.aspx")
End If
strUser = Request.QueryString("strUser")
strReport = Request.QueryString("strReport")
strPeriod = Request.QueryString("strPeriod")
strRegionType = Request.QueryString("strRegionType")
strRegion = Request.QueryString("strRegion")
strDate = Request.QueryString("strDate")
strUnit = Request.QueryString("strUnit")
If strUser <> "" And strReport <> "" Then
ConfigureCrystalReports()
Else
lblMessage.Text = "Values for the report where not received properly.<br /><br />" & strReport & "<br /><br />Please contact your Commissions Reporting Administrator<br /><br />"
End If
End If
Catch ex As Exception
ErrorRoutine(ex, "Page_Load")
End Try
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
GlobalCode.DisplayTitle("MetLife - Commissions Administration - Report Viewer", Page)
End Sub
Private Sub ConfigureCrystalReports()
Try
Dim i, j As Integer
Dim ParameterValue As String
_dsContacts = Nothing
_dsContacts = New DataSet
_dsContacts.ReadXml(Server.MapPath("XML\ReportFiles.xml"))
For i = 0 To _dsContacts.Tables(0).Rows.Count - 1
If Trim(UCase(_dsContacts.Tables(0).Rows(i)("FileName").ToString)) = Trim(UCase(strReport)) Then
Dim conn As ConnectionInfo = New ConnectionInfo()
Dim reportPath As String = Server.MapPath("Reports/" & _dsContacts.Tables(0).Rows(i)("FileName").ToString)
If Not File.Exists(reportPath) Then
lblMessage.Text = "Report does not exists in our servers.<br /><br />" & reportPath & "<br /><br />Please contact your Commissions Reporting Administrator<br /><br />"
Exit Sub
End If
conn.DatabaseName = _dsContacts.Tables(0).Rows(i)("Database").ToString
conn.UserID = _dsContacts.Tables(0).Rows(i)("UserID").ToString
conn.Password = _dsContacts.Tables(0).Rows(i)("Password").ToString
Dim ConnInfo As New ConnectionInfo
With ConnInfo
.DatabaseName = _dsContacts.Tables(0).Rows(i)("Database").ToString
.UserID = _dsContacts.Tables(0).Rows(i)("UserID").ToString
.Password = _dsContacts.Tables(0).Rows(i)("Password").ToString
End With
ParameterValue = ""
CRViewer.ReportSource = reportPath
CRViewer.ParameterFieldInfo.Clear()
Dim ParamFields As ParameterFields = CRViewer.ParameterFieldInfo
Dim reportSeparation As New ReportDocument()
reportSeparation.Load(reportPath)
For j = 0 To reportSeparation.ParameterFields.Count - 1
Dim param As New ParameterField
param.Name = reportSeparation.ParameterFields.Item(j).Name
Select Case param.Name
Case "VRPTTYPE"
ParameterValue = strRegionType
Case "VPARAM"
ParameterValue = strRegion
Case "VUSER"
ParameterValue = strUser
Case "VDATE"
ParameterValue = strDate
Case "VUNIT"
ParameterValue = strUnit
Case "VPERIOD"
ParameterValue = strPeriod
Case Else
lblMessage.Text = "<h1>Report has parameters not expected.</h1><br /><br /><h2>" & reportPath & "</h2><br /><br />Please contact your Commissions Reporting Administrator<br /><br />"
Exit Sub
End Select
Dim param_Value As New ParameterDiscreteValue
param_Value.Value = ParameterValue
param.CurrentValues.Add(param_Value)
ParamFields.Add(param)
Next '
For Each cnInfo As TableLogOnInfo In CRViewer.LogOnInfo
cnInfo.ConnectionInfo = ConnInfo
Next
CRViewer.DataBind()
Exit Sub
End If
Next
Catch ex As Exception
ErrorRoutine(ex, "ConfigureCrystalReports")
End Try
End Sub
Public Sub ErrorRoutine(ByVal ex As Exception, ByVal Routine As String)
GlobalCode.ErrorRoutine(ex, Routine, Master)
End Sub
End Class -
In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .
Hi Srinath,
The below blog might be useful
http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
regards,
Harish -
Found a bug in "Execute Stored Procedure..." command
Hi...I've found one interesting "feature": if I do click "Execute Stored Procedure"on SP, which contains an XML parameter (doesn't matter if it's input or output), Management Studio generates script without declaring datatype of that
parameter. But if I click "Generate Script" everything works fine. This situation can be observed in SQL Server 2005-2012.Hello,
Please submit a product feedback on Microsoft Connect:
https://connect.microsoft.com/sqlServer/
Thank you for sharing what you have discovered.
Regards,
Alberto Morillo
SQLCoffee.com -
Problem in executing Stored Procedure from Trigger
Hi,
Case1.
I am executing a stored procedure form a trigger. The stored procedure is not executing fully.
Case 2.
But when when I execute Stored Procedure alone it is executing.
CREATE OR REPLACE TRIGGER mhubadmin.call_proc_ratesheet_new
after INSERT OR delete ON mhubadmin.pvt_br_ratesheet
FOR EACH ROW
declare
var_orgid number;
begin
if inserting then
select org_child_id into var_orgid from business_relationship where br_id=:new.br_id;
mhubadmin.proc_ratesheet_new(var_orgid);
else
select org_child_id into var_orgid from business_relationship where br_id=:old.br_id;
mhubadmin.proc_ratesheet_new(var_orgid);
end if;
end;
CREATE OR REPLACE PROCEDURE proc_ratesheet_new(var_orgid in number)
IS
cursor c3 is select distinct(purs.user_id) from hubuser hu
inner join PVT_USER_RATESHEET purs on hu.USER_ID=purs.USER_ID
where hu.ORG_ID=var_orgid;
cursor c1(varUser_id number) is select purs.user_id,purs.ratesheet_id from hubuser hu
inner join PVT_USER_RATESHEET purs on hu.USER_ID=purs.USER_ID
where hu.ORG_ID=var_orgid and purs.USER_ID=varUser_id;
cursor c2(varUser_id number) is select hu.user_id,pbr.ratesheet_id from HUBUSER hu
inner join BUSINESS_RELATIONSHIP br on hu.ORG_ID=br.ORG_CHILD_ID
inner join PVT_BR_RATESHEET pbr on br.BR_ID=pbr.BR_ID
where hu.user_id in(select distinct(purs.USER_ID) from hubuser hu
inner join PVT_USER_RATESHEET purs
on hu.USER_ID=purs.USER_ID
where hu.ORG_ID=var_orgid) and hu.user_id=varUser_id;
foundFlag boolean;
incrFound integer;
insertFound integer;
deleteFound integer;
str varchar2(4000);
BEGIN
incrFound:=0;
insertFound:=0;
for c3var in c3 loop
for c2var in c2(c3var.user_id) loop
insert into test values ('Step3:'||c2var.user_id);
foundFlag:=false;
for c1var in c1(c3var.user_id) loop
if c2var.ratesheet_id=c1var.ratesheet_id then
foundFlag:=true;
incrFound:=incrFound+1;
exit;
end if;
end loop;
if foundFlag=False then
--insert into pvt_user_ratesheet (username_ratesheet_id,user_id,ratesheet_id) values (SEQ_USER_RATESHEET.nextval,c3var.user_id,c2var.ratesheet_id);
dbms_output.put_line('Inserted for user :'||c3var.user_id||' is - ratesheet :'||c2var.ratesheet_id);
insertFound:=insertFound+1;
end if;
end loop;
end loop;
commit;
incrFound:=0;
deleteFound:=0;
for c3var in c3 loop
for c1var in c1(c3var.user_id) loop
foundFlag:=false;
for c2var in c2(c3var.user_id) loop
if c1var.ratesheet_id=c2var.ratesheet_id then
foundFlag:=true;
incrFound:=incrFound+1;
exit;
end if;
end loop;
if foundFlag=False then
--delete from pvt_user_ratesheet where user_id=c3var.user_id and ratesheet_id=c1var.ratesheet_id;
--dbms_output.put_line('Deleted for userid:'||c3var.user_id||' for ratesheet :'||c1var.ratesheet_id);
deleteFound:=deleteFound+1;
end if;
end loop;
end loop;
commit;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.put_line (SQLCODE||' '|| SQLERRM);
END;
Regards,
MathewIn general, I would suggest that you only catch errors that you can handle reasonably. If you know that a SELECT INTO might return 0 rows for example, handle the NO_DATA_FOUND exception. Having a WHEN OTHERS, particularly without re-raising the exception, only serves to hide the source of the problem. I would much rather that my code fail quickly and explicitly than hope that I see an error message in the output and that other code doesn't start failing because the system wasn't left in an appropriate state.
As Mark suggests, you may choose to implement a comprehensive logging framework using autonomous transactions, in which case a WHEN OTHERS would be reasonable, but you would still want to propagate exceptions you cannot handle.
If you see a WHEN OTHERS clause and there is no RAISE, you probably have an error waiting to happen.
Justin -
Stored procedures for User Tables
Can somebody please help me with this matter?. I need to add stored procedures for user tables. Is there any way of doing so?.
Thanks in advance.
Ernesto.Ernesto,
You have posted multiple threads for the same question. Please check the other thread and close this one:
Stored procedures in User Tables
Thanks,
Gordon -
Execute stored procedure as sysadmin
Hi,
I am running powershell script to execute stored procedure on SQL server. Powershell script is run with low privilege user account on SQL server, but SP is restoring databases and requires sysadmin permissions. How can I execute SP with sysadmin permissions?
Could this be done proxy account? without additional users creation. Any links? ThanksYou can create the sp using a sysadmin account (or in dbo schema) and use EXECUTE AS OWNER inside it
Then give the powershell account execute access to the procedure and it will run under context of dbo user (or owner account) which will have necessary permission to do the data base restore etc
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Could not execute stored procedure in oracle
hello experts,
Problem: I can not execute stored procedures stored in Oracle data base. Error Message: Portal request failed. Could not execute stored procedure.
My steps:
i connected my locally installed Oracle data base to the VC. I mapped the data base user to my VC user. I tested connection and it is fine. Further I see the db alias in Visual Composer and i can drop stored procedures to my story board. I can define parameters, but when I am executing procedures I get the error message.
Further I installed MS SQL Server lokally and connected to the VC and it is working fine. I can do everything.
Why it is not working for Oracle DB?
DriverName: com.sap.portals.jdbc.oracle.OracleDriver
Connect-URL: jdbc:sap:oracle://ip:port;sid=XE
Any comment is highly appreciated.
anton.Hi,
Also you can follow this link which explains you the procedure to configure BI JDBC system for visual composer.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6209b52e-0401-0010-6a9f-d40ec3a09424
Regards
Inder
Do reward points if helpful. -
Entity Framework - Execute Stored Procedures
I want to execute stored procedure using entity framework.
I am using entity framework 6.
The stored procedure has SELECT and RETURN statement.
How can I read the output from SELECT and RETURN statements using
dbContext.Database.ExecuteSqlCommand or dbContext.Database.SqlQuery statement ?Hello Sumit Kadam,
>> The stored procedure has SELECT and RETURN statement.
For the select statement, Entity Framework would support natively:
http://www.entityframeworktutorial.net/stored-procedure-in-entity-framework.aspx
For the return statement, we could use the dbContext.Database.SqlQuery statement as below to fetch the value:
var returnCode = new SqlParameter();
returnCode.ParameterName = "@ReturnCode";
returnCode.SqlDbType = SqlDbType.Int;
returnCode.Direction = ParameterDirection.Output;
// assign the return code to the new output parameter and pass it to the sp
var data = db.Database.SqlQuery<Order>("exec @ReturnCode = ProGetOrder", returnCode);
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to customize events, execute stored procedures using JSF and ADF BC
As a java beginner, I started with developing simple web application using JSF and ADF business component through visual and declarative approach. I need to know how to customize events, execute stored procedures, invoke functions on triggering events associated with rich controls. for eg. how to write customized functions on button click or checkbox click events to achieve business requirement and can be modified whenever required.
Edited by: 792068 on Aug 31, 2010 9:40 PMWhich business layer is prefered to create interactive data model: 1. ADF business components or 2. Enterprise JavaBeans using Java persistance API (JPA) or 3. Toplink 4. Portlets
which minimizes writing low level codes and how much OOPS knowledge is required for creating above business layer binding data to viewcontroller layer? -
Execute Stored Procedures from Stellent
Can we execute stored procedures from stellent 7.5.2 ?
By using java, I dont find any method to execute stored procedure from WorkSpace interface.
Please guide me to solve this..
Appreciate your help and efforts.May not be exactly what you're looking for, but I hope this helps:
http://www.corecontentonly.com/Blog/Calling-A-Stored-Procedure-From-Oracle-Fusion-ECM-Stellent
For java based execution basically:
1. Create your stored proc in the db
2. Create a component
3. Create a query resource
4. In your java code use the createResultSet method of the Workspace object and pass in the name of your query resource and then the current databinder object -
Execute stored procedure from Unix shell script
My current method of executing stored procedures (wpl_1 and wpl_2) from a unix shell script is as follows:
<<wpl.sh>>
sqlplus user/password @/home/oracle/scripts/wpl.sql
<<wpl.sql>>
set serveroutput on size 1000000
set timing on
execute wpl_1('0000010676','~')
execute wpl_2('0000010676','~')
execute wpl_1('0000010236','FIX')
execute wpl_2('0000010236','FIX')
exit
Question: Is it possible to combine the two scripts (unix and oracle) together?A little rusty on this, but this may work:
My current method of executing stored procedures
(wpl_1 and wpl_2) from a unix shell script is as
follows:
<<wpl.sh>>sqlplus user/password @/home/oracle/scripts/wpl.sql << EOF
set serveroutput on size 1000000
set timing on
execute wpl_1('0000010676','~')
execute wpl_2('0000010676','~')
execute wpl_1('0000010236','FIX')
execute wpl_2('0000010236','FIX')
exit
EOF
>
Question: Is it possible to combine the two scripts
(unix and oracle) together? -
How to create a stored procedure and use it in Crystal reports
Hi All,
Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
Thanks in advance.If you are using MSSQL SERVER then try creating a stored procedure like this
create proc Name
select * from Table
by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
here is the syntax to create SP
Syntax
CREATE PROC [ EDURE ] procedure_name [ ; number ]
[ { @parameter data_type }
[ VARYING ] [ = default ] [ OUTPUT ]
] [ ,...n ]
[ WITH
{ RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
[ FOR REPLICATION ]
AS sql_statement [ ...n ]
Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
Regards,
Raghavendra
Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM
Maybe you are looking for
-
Error in creation of database (planning 9.3.1) base- SQL2005
This error appears when you create database (planning 9.3.1) base- SQL2005. com.hyperion.planning.olap.EssbaseException (1019060) I would be grateful, if you give me advices how to solve it. Thank you
-
My Time Capsule has stopped working. Restoring default settings does not work.
I have a 2TB Time Capsule (Model No. A1409). I think that it is approximately 20 months old. It has been working very well until around two months ago, when it began to display the flashing amber light. At that time I performed a hard reset, resto
-
Cloud set up, Old Mobile me, too wanna share Gallery!
Cant make it work.... How? I have numerous photo albums and a a few videos in my gallery. I want to share a video I uploaded today, getting plug in failure messages (where I used to get none) when attemting to play in gallery. .mov file exported from
-
Can I modify the default text in an email submission?
When I press the "submit email" button on my form, it opens Lotus Notes (yes, gag, corporate decision) and appends the XML file to an email that states: "The attached file contains data that was entered into a form. It is not the form itself. The rec
-
N97 trying to connect to the internet *wasting my ...
I've been using this phone for atleast a month now. and i've noticed in the log my phone keeps on trying to connect to my home wi-fi, and if that isnt available it tries to connect to Vodafone AU Internet (one of the accesss points). now this costs m