LEXICAL REFERENCES IN STORED PROCEDURES
CAN I TO DO LEXICAL REFERENCES IN STORED FUNCTIONS AND STORED
PROCEDURES ?
THANK'S FOR ANY HELP.
What is your application release?
Not sure if I understand you correctly, but have you reviewed (How To Use Oracle.Apps.Fnd.Flex.Kff.Select To Retrieve Particular Segments And Not All Segments from a Flexfield [ID 1267032.1]) and see if it helps?
Thanks,
Hussein
Similar Messages
-
Circular references between stored procedures
Hi, i need help about circular references. I have two stored procedures that references like that:
create or replace
procedure ciclico2 as
begin
ciclico1;
end;
create or replace
procedure ciclico1 as
begin
ciclico2;
end;
I can't compile both... so i want to know if there are ways to do that...
Thanks
Marcos (from Argentina... with a medium level english)¡Hola, Marcos!
If the procedures are in packages (or the same package), you can compile the package specs first, and then the package bodies.
It's simpler if both procedures are in the same package:
CREATE OR REPLACE PACKAGE pk_fubar
AS
PROCEDURE ciclico1;
PROCEDURE ciclico2;
END pk_fubar;
SHOW ERRORS
CREATE OR REPLACE PACKAGE BODY pk_fubar
AS
PROCEDURE ciclico1
IS
BEGIN
ciclico2;
END ciclico1
PROCEDURE ciclico2
IS
BEGIN
ciclico1;
END ciclico2
END pk_fubar
SHOW ERRORSOr you could put just one of them in a package.
The important thing is that you can compile a package spec and a package body separately.
You can compile anything that references a function in a package if a valid package spec exists; the package body may be invalid, or it may not exist at all. The package body has to exist and be valid before you run the procedure that calls it, of course, but not necessarily when you compile it. -
DBA_FREE_SPACE reference in stored procedure
Hi all,
I tried googling around and could not find a solution. I am referencing the DBA_FREE_SPACE system view in a stored procedure. I received an error for insuffiient privileges for that particular piece of the stored proc. I then explicity granted SELECT on the system view to the user schema which holds the stored proc. I still am getting the insufficient privileges error and can not figure out why. Has anyone experienced this or do you have any ideas I can try?
Thanks in advance.andy_schnelle wrote:
Hi all,
I tried googling around and could not find a solution. I am referencing the DBA_FREE_SPACE system view in a stored procedure. I received an error for insuffiient privileges for that particular piece of the stored proc. I then explicity granted SELECT on the system view to the user schema which holds the stored proc. I still am getting the insufficient privileges error and can not figure out why. Has anyone experienced this or do you have any ideas I can try?
Thanks in advance.
Maybe we should see your code and the exact error message, not your interpretation of the error. Typically, not having SELECT privilge on a table or view will return 'ORA-00942: table or view does not exist'.
SQL> conn scott/tiger
ERROR:
ORA-28001: the password has expired
Changing password for scott
New password:
Retype new password:
Password changed
Connected.
SQL> select * from dba_free_space;
select * from dba_free_space
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> conn / as sysdba
Connected.
SQL> grant select on dba_free_space to scott;
Grant succeeded.
SQL> conn scott/lion
Connected.
SQL> select * from dba_free_space;
TABLESPACE_NAME FILE_ID BLOCK_ID BYTES BLOCKS
RELATIVE_FNO -
How to invoke a stored procedure by WSIF?
If it can, how to do? what the WSDL looks like?
Can anybody give me an example?
Thanks.Thanks all for your replies. I will search the api for callable statements. I am curious though, the reply that suggests using a prepared statement - can I put the name of a stored procedure in a prepared statment or is this just suggestions an action query like Insert Into, Update, Delete? Like with ADO you can say
cmdObject.CommandType = adStoredProcedure
cmdObject.CommandText = "NameOfStoredProc"
cmdObject.ExecuteNonQuery()
Once I am calling/importing/implementing the proper libraries/interfaces in Java, can a prepared statement reference a stored procedure as above?
Thanks -
How to invoke a stored procedure on MS Sql Server with Java?
I started writing Enterprise Java Beans and created an ODBC dsn with MS Sql Server 2000 which I can access using jdbc:odbc:mySqlDSN. This all works fine using Java Sql Statements. What kind of Java/Java Sql statement can I use to invoke a stored procedure on the Sql Server? Is it possible to use ADO/ADO command objects with Java? Is it possible to import/implement Mdac2.6 ActiveX data objects libary in Java?
ThanksThanks all for your replies. I will search the api for callable statements. I am curious though, the reply that suggests using a prepared statement - can I put the name of a stored procedure in a prepared statment or is this just suggestions an action query like Insert Into, Update, Delete? Like with ADO you can say
cmdObject.CommandType = adStoredProcedure
cmdObject.CommandText = "NameOfStoredProc"
cmdObject.ExecuteNonQuery()
Once I am calling/importing/implementing the proper libraries/interfaces in Java, can a prepared statement reference a stored procedure as above?
Thanks -
How to use lexical parameters with Sql Server Stored Procedure?
Hi,
I'm developing a BI Publisher report on a sql server database. I need to execute a stored procedure to dynamically build the query by replacing the lexical parameters with the values of varaibles of the stored procedure. With Oracle stored procedures, I have used data template and had reference the varaiable in SP by prefixing it with '&'.
It doesn't work if I try to do the same thing with SQL server. Is there anyone who has come across the similar situation? Please let me know if anyone has got any ideas...
Thanks in Advance
RagTopLink currently doesn't support multiple ResultSets. Multiple ResultSets support is considered for a future release.
-
Stored procedure with multiple Reference Cursors
In Sybase and SQLServer, result sets are returned to the application implicitly. Oracle emulates this by passing back weak reference cursors to the application through an IN OUT parameter.The number of reference cursors must match the number of results sets. For example, if 2 select statements are present in the stored procedure code, then 2 reference cursors are passed back.The Oracle Migration Workbench creates the correct number of reference cursors but assigns each select statement results to the first cursor created. Therefore only the last set of results are returned to the client.
Before (SQLServer)
CREATE PROCEDURE get_sch_associated_appointment_info (@piAcc_itn int) AS SELECT s.acc_itn, r.internal_key, r.mnemonic, r.descp, sh.start_dtime, sh.end_dtime FROM schdtl s, schdtlhdr sh, resource r WHERE s.acc_itn = @piAcc_itn and sh.acc_itn = @piAcc_itn and sh.resource_itn = r.internal_key SELECT sdcr.acc_itn, sdcr.rsch_dtime, sdcr.rsch_by_init, sdcr.rsch_code, sdcr.rsch_reason, sdcr.cncl_dtime, sdcr.cncl_by_init, sdcr.cncl_code, sdcr.cncl_reason, sdcr.prev_start_dtime, sdcr.prev_by_init FROM schdtl_canrsch sdcr WHERE sdcr.acc_itn = @piAcc_itn SELECT sdi.acc_itn, i.sched_notes, i.post_sched_notes, d.pre_sch_notes, d.post_sch_notes, i.detail_key, i.output_notes FROM schdtl_info sdi, extitem i, dept d WHERE sdi.acc_itn = @piAcc_itn and sdi.actual_dept = i.dept and sdi.actual_proc_no = i.proc_no and sdi.actual_dept = d.dept
After (Migration Workbench) â Optional Section
CREATE OR REPLACE PROCEDURE get_sch_associated_appointment_info (piAcc_itn int, RC1 IN OUT Omwb_emulation.globalPkg.RCT1) AS OPEN RC1 SELECT s.acc_itn, r.internal_key, r.mnemonic, r.descp, sh.start_dtime, sh.end_dtime FROM schdtl s, schdtlhdr sh, resource r WHERE s.acc_itn = piAcc_itn and sh.acc_itn = piAcc_itn and sh.resource_itn = r.internal_key; OPEN RC1 SELECT sdcr.acc_itn, sdcr.rsch_dtime, sdcr.rsch_by_init, sdcr.rsch_code, sdcr.rsch_reason, sdcr.cncl_dtime, sdcr.cncl_by_init, sdcr.cncl_code, sdcr.cncl_reason, sdcr.prev_start_dtime, sdcr.prev_by_init FROM schdtl_canrsch sdcr WHERE sdcr.acc_itn = piAcc_itn; OPEN RC1 SELECT sdi.acc_itn, i.sched_notes, i.post_sched_notes, d.pre_sch_notes, d.post_sch_notes, i.detail_key, i.output_notes FROM schdtl_info sdi, extitem i, dept d WHERE sdi.acc_itn = piAcc_itn and sdi.actual_dept = i.dept and sdi.actual_proc_no = i.proc_no and sdi.actual_dept = d.dept;
After (Manual Change)
CREATE OR REPLACE PROCEDURE get_sch_associated_appointment_info (piAcc_itn int, RC1 IN OUT Omwb_emulation.globalPkg.RCT1, RC2 IN OUT Omwb_emulation.globalPkg.RCT1, RC3 IN OUT Omwb_emulation.globalPkg.RCT1) AS OPEN RC1 SELECT s.acc_itn, r.internal_key, r.mnemonic, r.descp, sh.start_dtime, sh.end_dtime FROM schdtl s, schdtlhdr sh, resource r WHERE s.acc_itn = piAcc_itn and sh.acc_itn = piAcc_itn and sh.resource_itn = r.internal_key; OPEN RC2 SELECT sdcr.acc_itn, sdcr.rsch_dtime, sdcr.rsch_by_init, sdcr.rsch_code, sdcr.rsch_reason, sdcr.cncl_dtime, sdcr.cncl_by_init, sdcr.cncl_code, sdcr.cncl_reason, sdcr.prev_start_dtime, sdcr.prev_by_init FROM schdtl_canrsch sdcr WHERE sdcr.acc_itn = piAcc_itn; OPEN RC3 SELECT sdi.acc_itn, i.sched_notes, i.post_sched_notes, d.pre_sch_notes, d.post_sch_notes, i.detail_key, i.output_notes FROM schdtl_info sdi, extitem i, dept d WHERE sdi.acc_itn = piAcc_itn and sdi.actual_dept = i.dept and sdi.actual_proc_no = i.proc_no and sdi.actual_dept = d.dept;I believe you are using .NET(?). If that is the case, please post this query to the .NET Development - Crystal Reports forum:
SAP Crystal Reports, version for Visual Studio
That forum is monitored by qualified technicians and you will get a faster response there.
Thank you for your understanding,
Ludek -
Reference images in stored procedures
I wasn't able to find the way to reference images uploaded in HTMLDB repository from a stored procedure (that use htp).
please can anybody help me?
Thanks
Francesco Galanteimages, files, and css's uploaded to the htmldb repository are referenced with the #WORKSPACE_IMAGES# substitution string. images uploaded into your workspace's repository that are associated with a specific app can be referenced with #APP_IMAGES#. we talked a bit about this at...
How do I refer uploaded images or css files in templates?
...and to reference those images in your stored procedures you'd simply use the V() syntax instead of that substitution string one. references like v('APP_IMAGES') and v('WORKSPACE_IMAGES') in commands like...
htp.p('<img src="'||v('WORKSPACE_IMAGES')||'my_image.jpg">');
...would do it.
hope this helps,
raj -
Consider a situation where a stored procedure taking a varbinary(max) (BLOB) input parameter
then calls a nested stored procedure and passes along that varbinary(max) as an input parameter to the nested stored procedure.
Is a copy of the BLOB provided to the nested stored procedure (passed by value) OR is the BLOB passed by reference.
My interest is in understanding the potential memory hit when handling large BLOBs in this environment.
For example, if the BLOB is 200MB, will SQL server need to allocate memory for a new copy each time it's passed to another stored procedure at the next nestlevel?
Looks like table type parameters are passed by reference, but I haven't been able to find any info on BLOBS in this context.The semantics for parameters in SQL Server is copy-in/copy-out. However, this does not mean that there cannot be optimizations. That is, there is no need to copy the BLOB, as long as the procedure does not change it. Whether they actually have such an optimization,
I don't know.
I composed the repro below, and it is sort of interesting. If I restart my instance (SQL 2014), the memory usage grows with about 40 M for each nesting call, which certainly indicates that the BLOB is copied over and over again. But if I then run it again,
the growth is not the same. This may be because, it uses buffers already available. (A BLOB has to be a handle like a table when it is over some size.) Then again, it means that it is squeezing something else out of the cache.
CREATE PROCEDURE K @h varchar(MAX) AS
SELECT SUM(pages_kb)*8192 AS K, datalength(@h) as Dlen FROM sys.dm_os_memory_clerks
SELECT @h = ''
go
CREATE PROCEDURE L @h varchar(MAX) AS
SELECT SUM(pages_kb)*8192 AS L1, datalength(@h) as Dlen FROM sys.dm_os_memory_clerks
EXEC K @h
SELECT SUM(pages_kb)*8192 AS L2, datalength(@h) as Dlen FROM sys.dm_os_memory_clerks
--SELECT @h = ''
go
CREATE PROCEDURE M @h varchar(MAX) AS
SELECT SUM(pages_kb)*8192 AS M1, datalength(@h) as Dlen FROM sys.dm_os_memory_clerks
EXEC L @h
SELECT SUM(pages_kb)*8192 AS M2, datalength(@h) as Dlen FROM sys.dm_os_memory_clerks
--SELECT @h = ''
go
CREATE PROCEDURE N @h varchar(MAX) AS
SELECT SUM(pages_kb)*8192 AS N1, datalength(@h) as Dlen FROM sys.dm_os_memory_clerks
EXEC M @h
SELECT SUM(pages_kb)*8192 AS N2, datalength(@h) as Dlen FROM sys.dm_os_memory_clerks
--SELECT @h = ''
go
DECLARE @h varchar(MAX) = replicate(cast('ABCD' AS varchar(MAX)), 1E7)
EXEC N @h
go
DROP PROCEDURE K, L, M, N
Erland Sommarskog, SQL Server MVP, [email protected] -
Another schema reference in a stored procedure
Hello -
I need to call a stored procedure from another stored procedure in a different schema. Can this be done?
For example:
I am logged on as USER1 and I try to call these stored procedures from within a stored procedure:
DO_STUFF (works - within one schema)
USER2.DO_STUFF (does not compile)
INSERT INTO USER2.SOME_TABLE VALUES(...) (does not run -table does not exist)
Thanks!
PeterVinay,
Spend some time online to read and search about your problem before blindly posting it on forum, if you would have done that you could have found out eaisly below two links which will explain you in deep
http://stackoverflow.com/questions/3682821/difference-between-varchar500-vs-varcharmax-in-sql-server
http://sqlhints.com/2013/03/10/difference-between-sql-server-varchar-and-varcharmax-data-type/
Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it
My Technet Wiki Article
MVP -
ORA-03111 - JCA Binding error while invoking a stored procedure in DB
Hi,
We are facing this problem for one interface alone.
Need expert advice to fix this problem..
This is scheduled to run once in a day and fails daily for past 2 weeks..
We receive below error as response..
Same interface worked fine for past 1 yr..
Also it works fine if we reprocess the batch in next day morning...
Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'DB_Legacy_To_EBS_Invoice_Conversion' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the IRSOA.AR_SOA_INVOICE.TRN_GET_CUST_INV_RAW_TO_STAGE API. An error occurred while preparing and executing the IRSOA.AR_SOA_INVOICE.TRN_GET_CUST_INV_RAW_TO_STAGE API. Cause: java.sql.SQLException: ORA-03111: break received on communication channel ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.
AND
Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'DB_Legacy_To_EBS_Invoice_Conversion' failed due to: Stored procedure invocation error. Error while trying to prepare and execute the IRSOA.AR_SOA_INVOICE.TRN_GET_CUST_INV_RAW_TO_STAGE API. An error occurred while preparing and executing the IRSOA.AR_SOA_INVOICE.TRN_GET_CUST_INV_RAW_TO_STAGE API. Cause: java.sql.SQLException: ORA-01013: user requested cancel of current operation ORA-06512: at "IRSOA.XXIR_AR_SOA_CUSTOMER_INVOICE", line 213 ORA-06512: at line 1 ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution
Thanks,
SundaramLooks like the SQL might be taking a longer time to execute and might be timing out.
Please refer the following:
Re: ORA-01013: user requested cancel of current operation
http://www.dba-oracle.com/t_ora_01013_user_requested_cancel_of_current_operation.htm
Additionally, ORA-06512 indicates that there is a mismatch of the with the data length that is being processed. Refer http://www.techonthenet.com/oracle/errors/ora06512.php
Hope this helps.
Thanks,
Patrick -
Why doesn't SSRS like an IF Statement in my SQL Stored Procedure???
I have multiple IF Statements at the end of my SQL Stored Procedure Process that utilizes a @ReportTypeName Parameter to produce the chosen report result set
IF @ReportTypeName = 'HMO-POS New To HFHP - No Prior Year Member Spans'
BEGIN
SELECT DISTINCT
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Member Contract Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Member Subscriber Member Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Pkg],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Division Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER EFF DATE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER FIRST NAME],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER LAST NAME],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Broker Name],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER ADDRESS 1],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER CITY],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER STATE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER ZIPCODE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE1],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE2],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE3],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER EMAIL],
CONVERT(VARCHAR,CAST(CONVERT(VARCHAR, [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER YMDBIRTH]) AS DATETIME),101) AS [INDV MEMBER BirthDate],
FLOOR((CAST (GETDATE() AS INTEGER) - CAST(CONVERT(DATETIME, CONVERT(CHAR(8), [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER YMDBIRTH])) AS INTEGER)) / 365.25) AS [INDV MEMBER AGE]
FROM [#TempTable_Distinct_Individual_Member_All_Info]
WHERE (CHARINDEX('HMO',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0
OR CHARINDEX('POS',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0)
AND [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR] NOT IN
(SELECT [#TempTable_Distinct_Individual_Member_Prior_Year_Spans].[INDV MEMBER NBR]
FROM [#TempTable_Distinct_Individual_Member_Prior_Year_Spans])
ORDER BY [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR]
END
IF @ReportTypeName = 'HMO-POS Renewals'
BEGIN
SELECT DISTINCT
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Member Contract Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Member Subscriber Member Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Pkg],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Division Nbr],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER EFF DATE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER FIRST NAME],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER LAST NAME],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV Broker Name],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER ADDRESS 1],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER CITY],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER STATE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER ZIPCODE],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE1],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE2],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER PHONE3],
[#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER EMAIL],
CONVERT(VARCHAR,CAST(CONVERT(VARCHAR, [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER YMDBIRTH]) AS DATETIME),101) AS [INDV MEMBER BirthDate],
FLOOR((CAST (GETDATE() AS INTEGER) - CAST(CONVERT(DATETIME, CONVERT(CHAR(8), [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER YMDBIRTH])) AS INTEGER)) / 365.25) AS [INDV MEMBER AGE]
FROM [#TempTable_Distinct_Individual_Member_All_Info]
INNER JOIN [#TempTable_Distinct_Individual_Member_Prior_Year_Spans]
ON [#TempTable_Distinct_Individual_Member_Prior_Year_Spans].[INDV MEMBER NBR] = [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR]
WHERE (CHARINDEX('HMO',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0
OR CHARINDEX('POS',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0)
ORDER BY [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR]
END
Microsoft Visual Studio and SQL Server Reporting Services did not like this! When I added my dataset and parameters accordingly, my Dataset had no fields...almost as if running the Stored Procedure in the background to get its Metadata was not working. I
know this works because I tested it as a result of a straight EXEC Command. Why doesn't Microsoft Visual Studio and SQL Server Reporting Services not like this IF? I did end up getting around this by parameterizing the WHERE clause based on the @ReportTypeName
chosen.
WHERE (@ReportTypeName = 'HMO-POS New To HFHP - No Prior Year Member Spans'
AND (CHARINDEX('HMO',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0
OR CHARINDEX('POS',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0)
AND [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR] NOT IN
(SELECT [#TempTable_Distinct_Individual_Member_Prior_Year_Spans].[INDV MEMBER NBR]
FROM [#TempTable_Distinct_Individual_Member_Prior_Year_Spans]))
OR (@ReportTypeName = 'HMO-POS Renewals'
AND (CHARINDEX('HMO',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0
OR CHARINDEX('POS',LTRIM(RTRIM([#TempTable_Distinct_Individual_Member_All_Info].[INDV Benefit Plan Name])),1) > 0)
AND [#TempTable_Distinct_Individual_Member_All_Info].[INDV MEMBER NBR] IN
(SELECT [#TempTable_Distinct_Individual_Member_Prior_Year_Spans].[INDV MEMBER NBR]
FROM [#TempTable_Distinct_Individual_Member_Prior_Year_Spans]))
I appreciate your review and am hopeful for a reply.
Thanks!Hi ITBobbyP,
I have tested on my local environment and can reproduce the issue, the issue can be caused by the temp table you are using which will also cause the data not display.
I have use below sample table and record to have a test and details information below for your reference:
Right click the DataSet to select the "DataSet Properties" and click the query designer to execute the stored procedure by click the "!" to check if you can get the data:
If you got some error, the issue can be cause by the temp table invalid, so please make sure you have add the query to create and insert recored to temp table like below:
CREATE PROCEDURE vickytest0311_1
@ReportTypeName nvarchar(50)
AS
create table #VickyTest
column1 int,
column2 varchar(20)
insert into #VickyTest values (1,'Test1')
insert into #VickyTest values (2,'Test2')
insert into #VickyTest values (3,'Test3')
IF @ReportTypeName ='Test1'
BEGIN
select * from #VickyTest
where Column1=1
END
IF @ReportTypeName ='Test2'
BEGIN
select * from #VickyTest
where Column1=2
END
GO
3. I recommend you to not use the temp table and you will not need to add the create and insert statement in the stored procedure.
4. If you still got no data, please try to click the "Refresh fields" as below:
If you still have any problem, please feel free to ask.
Regards,
Vicky Liu
Vicky Liu
TechNet Community Support -
How to get an updatable ADODB Recordset from a Stored Procedure?
In VB6 I have this code to get a disconnected ADODB Recordset from a Oracle 9i database (the Oracle Client is 10g):
Dim conSQL As ADODB.Connection
Dim comSQL As ADODB.Command
Dim recSQL As ADODB.Recordset
Set conSQL = New ADODB.Connection
With conSQL
.ConnectionString = "Provider=OraOLEDB.Oracle;Password=<pwd>;Persist Security Info=True;User ID=<uid>;Data Source=<dsn>"
.CursorLocation = adUseClientBatch
.Open
End With
Set comSQL = New ADODB.Command
With comSQL
.ActiveConnection = conSQL
.CommandType = adCmdStoredProc
.CommandText = "P_PARAM.GETALLPARAM"
.Properties("PLSQLRSet").Value = True
End With
Set recSQL = New ADODB.Recordset
With recSQL
Set .Source = comSQL
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
.Open
.ActiveConnection = Nothing
End With
The PL/SQL Procedure is returning a REF CURSOR like this:
PROCEDURE GetAllParam(op_PARAMRecCur IN OUT P_PARAM.PARAMRecCur)
IS
BEGIN
OPEN op_PARAMRecCur FOR
SELECT *
FROM PARAM
ORDER BY ANNPARAM DESC;
END GetAllParam;
When I try to update some values in the ADODB Recordset (still disconnected), I get the following error:
Err.Description: Multiple-step operation generated errors. Check each status value.
Err.Number: -2147217887 (80040E21)
Err.Source: Microsoft Cursor Engine
The following properties on the Command object doesn't change anything:
.Properties("IRowsetChange") = True
.Properties("Updatability") = 7
How can I get an updatable ADODB Recordset from a Stored Procedure?4 years later...
I was having then same problem.
Finally, I've found how to "touch" the requierd bits.
Obviously, it's hardcore, but since some stupid at microsoft cannot understand the use of a disconnected recordset in the real world, there is no other choice.
Reference: http://download.microsoft.com/downlo...MS-ADTG%5D.pdf
http://msdn.microsoft.com/en-us/library/cc221950.aspx
http://www.xtremevbtalk.com/showthread.php?t=165799
Solution (VB6):
<pre>
Dim Rst As Recordset
Rst.Open "select 1 as C1, '5CHARS' as C5, sysdate as C6, NVL(null,15) as C7, null as C8 from DUAL", yourconnection, adOpenKeyset, adLockBatchOptimistic
Set Rst.ActiveConnection = Nothing
Dim S As New ADODB.Stream
Rst.Save S, adPersistADTG
Rst.Close
Set Rst = Nothing
With S
'Debug.Print .Size
Dim Bytes() As Byte
Dim WordVal As Integer
Dim LongVal As Long
Bytes = .Read(2)
If Bytes(0) <> 1 Then Err.Raise 5, , "ADTG byte 0, se esperaba: 1 (header)"
.Position = 2 + Bytes(1)
Bytes = .Read(3)
If Bytes(0) <> 2 Then Err.Raise 5, , "ADTG byte 9, se esperaba: 2 (handler)"
LongVal = Bytes(1) + Bytes(2) * 256 ' handler size
.Position = .Position + LongVal
Bytes = .Read(3)
If Bytes(0) <> 3 Then Err.Raise 5, , "ADTG, se esperaba: 3 (result descriptor)"
LongVal = Bytes(1) + Bytes(2) * 256 ' result descriptor size
.Position = .Position + LongVal
Bytes = .Read(3)
If Bytes(0) <> 16 Then Err.Raise 5, , "ADTG, se esperaba: 16 (adtgRecordSetContext)"
LongVal = Bytes(1) + Bytes(2) * 256 ' token size
.Position = .Position + LongVal
Bytes = .Read(3)
If Bytes(0) <> 5 Then Err.Raise 5, , "ADTG, se esperaba: 5 (adtgTableDescriptor)"
LongVal = Bytes(1) + Bytes(2) * 256 ' token size
.Position = .Position + LongVal
Bytes = .Read(1)
If Bytes(0) <> 6 Then Err.Raise 5, , "ADTG, se esperaba: 6 (adtgTokenColumnDescriptor)"
Do ' For each Field
Bytes = .Read(2)
LongVal = Bytes(0) + Bytes(1) * 256 ' token size
Dim NextTokenPos As Long
NextTokenPos = .Position + LongVal
Dim PresenceMap As Long
Bytes = .Read(3)
PresenceMap = Val("&H" & Right$("0" & Hex$(Bytes(0)), 2) & Right$("0" & Hex$(Bytes(1)), 2) & Right$("0" & Hex$(Bytes(2)), 2))
Bytes = .Read(2) 'ColumnOrdinal
'WordVal = Val("&H" & Right$("0" & Hex$(Bytes(0)), 2) & Right$("0" & Hex$(bytes(1)), 2))
'Aca pueden venir: friendly_columnname, basetable_ordinal,basetab_column_ordinal,basetab_colname
If PresenceMap And &H800000 Then 'friendly_columnname
Bytes = .Read(2) 'Size
LongVal = Bytes(0) + Bytes(1) * 256 ' Size
.Position = .Position + LongVal * 2 '*2 debido a UNICODE
End If
If PresenceMap And &H400000 Then 'basetable_ordinal
.Position = .Position + 2 ' 2 bytes
End If
If PresenceMap And &H200000 Then 'basetab_column_ordinal
.Position = .Position + 2 ' 2 bytes
End If
If PresenceMap And &H100000 Then 'basetab_colname
Bytes = .Read(2) 'Size
LongVal = Bytes(0) + Bytes(1) * 256 ' Size
.Position = .Position + LongVal * 2 '*2 debido a UNICODE
End If
Bytes = .Read(2) 'adtgColumnDBType
'WordVal = Val("&H" & Right$("0" & Hex$(Bytes(0)), 2) & Right$("0" & Hex$(bytes(1)), 2))
Bytes = .Read(4) 'adtgColumnMaxLength
'LongVal = Val("&H" & Right$("0" & Hex$(Bytes(3)), 2) & Right$("0" & Hex$(Bytes(2)), 2) & Right$("0" & Hex$(Bytes(1)), 2) & Right$("0" & Hex$(Bytes(0)), 2))
Bytes = .Read(4) 'Precision
'LongVal = Val("&H" & Right$("0" & Hex$(Bytes(3)), 2) & Right$("0" & Hex$(Bytes(2)), 2) & Right$("0" & Hex$(Bytes(1)), 2) & Right$("0" & Hex$(Bytes(0)), 2))
Bytes = .Read(4) 'Scale
'LongVal = Val("&H" & Right$("0" & Hex$(Bytes(3)), 2) & Right$("0" & Hex$(Bytes(2)), 2) & Right$("0" & Hex$(Bytes(1)), 2) & Right$("0" & Hex$(Bytes(0)), 2))
Dim ColumnFlags() As Byte, NewFlag0 As Byte
ColumnFlags = .Read(1) 'DBCOLUMNFLAGS, First Byte only (DBCOLUMNFLAGS=4 bytes total)
NewFlag0 = ColumnFlags(0)
If (NewFlag0 And &H4) = 0 Then 'DBCOLUMNFLAGS_WRITE (bit 2) esta OFF
'Lo pongo en ON, ya que quiero escribir esta columna LOCALMENTE en el rst DESCONECTADO
NewFlag0 = (NewFlag0 Or &H4)
End If
If (NewFlag0 And &H8) <> 0 Then 'DBCOLUMNFLAGS_WRITEUNKNOWN (bit 3) esta ON
'Lo pongo en OFF, ya que no me importa si NO sabes si se puede updatear no, yo lo se, no te preocupes
'ya que quiero escribir esta columna LOCALMENTE en el rst DESCONECTADO
NewFlag0 = (NewFlag0 And Not &H8)
End If
If (NewFlag0 And &H20) <> 0 Then 'DBCOLUMNFLAGS_ISNULLABLE (bit 5) esta OFF
'Lo pongo en ON, ya que siendo un RST DESCONECTADO, si le quiero poner NULL, le pongo y listo
NewFlag0 = (NewFlag0 Or &H20)
End If
If NewFlag0 <> ColumnFlags(0) Then
ColumnFlags(0) = NewFlag0
.Position = .Position - 1
.Write ColumnFlags
End If
.Position = NextTokenPos
Bytes = .Read(1)
Loop While Bytes(0) = 6
'Reconstruyo el Rst desde el stream
S.Position = 0
Set Rst = New Recordset
Rst.Open S
End With
'TEST IT
On Error Resume Next
Rst!C1 = 15
Rst!C5 = "MUCHOS CHARS"
Rst!C7 = 23423
If Err.Number = 0 Then
MsgBox "OK"
Else
MsgBox Err.Description
End If
</pre> -
Call a Vbscript from a stored procedure
Hi,
I wonder is it possible to call a Vbscript from a stored procedure, any good reference for this.
thanksWell here is quick and dirty example I just created.
Step 1. Create a test_batch.bat file that creates a folder "c:\test_dir" and copy "c:emp.lst" into it.
C:\oracle102\examples\test_batch.bat
md c:\test_dir
copy c:\emp.lst c:\test_dir
Step2. From SQLPLUS, spool scott.emp into c:\emp.lst and call the batch from the dbms_scheduler that kicks off right away,
set echo off
set feedback off
spool c:\emp.lst;
select * from scott.emp;
spool off;
begin
dbms_scheduler.create_job(job_name => 'run_batch',
job_type => 'EXECUTABLE',
job_action => 'C:\oracle102\examples\test_batch.bat',
start_date => sysdate,
enabled => true,
comments => 'Run VB Script');
end;
Check if the directory is created and if the file is copied over. Task is to kick off the executable and test is the VBscript within the batch. Challenge is how long the script runs before the next statement in the PL/SQL runs. May be you have to introduce sleep in between.
Note: You must have at least "CREATE JOB" privilege.
Happy coding!
Prakash
Message was edited by:
Prakash Rai -
Can you get values back from a stored procedure via OUTPUT parameters?
Can you get values back from calling a stored procedure via OUTPUT parameters/variables? I call the SP via a SQL statement from a script either in a WF or DF.
I thought I read some reference that DI could not get the values from OUTPUT parameters but I could not find it again (don't know if it is in any of the documentation or referred to in a forum.
I did try a couple of tests but it did not reutrn any values via OUTPUT. But before I give up I thought I'd see if you could and maybe I needed to change something.This isn't exactly an answer to your question, but I'll point out that, given that you're resorting to a SQL script in the first place, there's no reason you can't also turn the output parameters into a regular result or record set. (The following uses T-SQL, although I think it's pretty generic.)
declare @param1 int, param2 varchar(100), @return int;
exec @return = proc @param1 = @param1 output, @param2 = @param2 output;
select @param1 as param1, @param2 as param2;
That is, to get from output parameters to a "regular" output from the SQL script isn't much of a leap...
Jeff Prenevost
BI Consultant
Ann Arbor, MI
Maybe you are looking for
-
IPad 2 will not charge or be recognized by iTunes
Ok... before anything is said, I have read basically every thread here and elsewhere regarding this issue. I have reset the iPad and done everything else many times over. The problem here is not exactly that my iPad will not charge no matter what. If
-
Since I starting using my MacMini (2011 version) I have not been able to print double sided from my HP Photosmart plus - there is no option for this in the Printer dialog box as there was in the similar dialog box on my PC. How do I set up this optio
-
Hi I need to import 9i export on 11g database. It is a huge export dump. I dont know the schemas in the dump. Hence I opted for read import file option in 11g Enterprise Manager. It has taken 2 hrs so far. Still it is reading. Is there a way to check
-
Can't print to windows 7 shared printer
I have been searching the web, trying to find a solution for the last week, but I can't find anything to help me have my OS X v10.4.11 Mac print to my HP printer connected to a Windows 7 Home Premium desktop. The mac can see the windows files fine an
-
Hello, While printing of outgoing excise invoice through T.code J1IV the system is by default selecting the output type "JEXC" so we were here created new Output type "ZEXC" , we want to make this value should be defaulted here in J1IV t code. How to