Value function (inheritance) in case clause
I need to use the Value function to verify if it is an instance of the object in a clause marries. It is possible?
example:
-- structure:
-- create type object1 is object(field1 number);
-- create type object2 under object1(field2 number);
-- create type ot is table of object1;
-- objs ot;
select case when (value(t) is of (object1)) then 1
when (value(t) is of ((object2)) then 2
and case
from table (cast (objs as ot)) t
help me please. thanks
Try creating object1 with NOT FINAL. Also, if you are going to use the supertype first in your CASE expression, you need to use IS OF (ONLY object1). Else put the child types first...
SQL> create or replace type object1 is object(field1 number) not final;
Type created.
SQL> create type object2 under object1(field2 number);
Type created.
SQL> create or replace type ot is table of object1;
Type created.
SQL> select case
2 when value(t) is of type (object1)
3 then 1
4 when value(t) is of type (object2)
5 then 2
6 end as supertype_goes_first
7 from table (cast(ot(object1(1),object2(1,2),object1(99),object2(2,100)) as ot)) t;
SUPERTYPE_GOES_FIRST
1
1
1
1
SQL>
SQL> select case
2 when value(t) is of (only object1)
3 then 1
4 when value(t) is of type (object2)
5 then 2
6 end as is_of_only
7 from table (cast(ot(object1(1),object2(1,2),object1(99),object2(2,100)) as ot)) t;
IS_OF_ONLY
1
2
1
2
SQL>
SQL> select case
2 when value(t) is of type (object2)
3 then 1
4 when value(t) is of type (object1)
5 then 2
6 end as subtype_before_supertype
7 from table (cast(ot(object1(1),object2(1,2),object1(99),object2(2,100)) as ot)) t;
SUBTYPE_BEFORE_SUPERTYPE
2
1
2
1
Similar Messages
-
SUBSTR function in the where clause
HI
I want to get a number of 15 digits from a column where the user only know the last 10 digits.
So that when the user enter a number with 10 digits, only the record of that specific number should be displayed.
And then when the user did not enter any number all the records in the table should be displayed.(this part works fine)
The problem is: when the user enters any last digits( last, second last, thirth last and so on) the records which satisfy this are retrieved, which is not supose to be the case.
I' am trying to use the substr function in the where clause but I'm not sure if it's working or not becasue the result of the query is just the same as before i used the substr.
Thanksbetter to pad with '*' me thinks in case u have a number ending with 0's:
1 select empno,ename
2 from emp
3* where empno like '%'||lpad('&1',2,'*')
SQL> /
Enter value for 1: 0
old 3: where empno like '%'||lpad('&1',2,'*')
new 3: where empno like '%'||lpad('0',2,'*')
no rows selected
SQL> /
Enter value for 1: 00
old 3: where empno like '%'||lpad('&1',2,'*')
new 3: where empno like '%'||lpad('00',2,'*')
EMPNO ENAME
7900 JAMES
SQL> /
Enter value for 1:
old 3: where empno like '%'||lpad('&1',2,'*')
new 3: where empno like '%'||lpad('',2,'*')
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
EMPNO ENAME
7900 JAMES
7902 FORD
7934 MILLER
14 rows selected. -
Problem with dg4msql and table-valued functions
Have configured dg4msql to connect from my oracle db to ms sql server.
Am able to do simple SELECTs from ms sql tables like:
select * from "sys"."procedures"@dg4msql;
or
select * from "dbo"."SomeTable"@dg4msql;
But am unable to do a SELECT from a table-valued function:
select * from "dbo"."GetData"@dg4msql('param1value');
or
select * from "dbo"."GetData"('param1value')@dg4msql;
In both cases I get:
ORA-00933: SQL command not properly ended
It does not like the parameters portion of the query ("('param1value')")
initdg4msql.ora:
HS_FDS_CONNECT_INFO=[svr1]//mydb
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_PROC_IS_FUNCT=TRUE
HS_FDS_RESULTSET_SUPPORT=TRUE
Have tried the other set of params:
HS_FDS_PROC_IS_FUNCT=FALSE
HS_FDS_RESULTSET_SUPPORT=TRUE
Same story. After changing the init*** file have bounced both Listeners (DB and Gateway), reconnected, and re-run the query.
Have I missed something?
Any help is greatly appreciated!Sorry, but for me it looks you did not get the problem.
Oracle® Database Gateway for SQL Server User's Guide,:
11g Release 2 (11.2)
Part Number E12069-02
*2 SQL Server Gateway Features and Restriction*
Result Sets and Stored Procedures
The Oracle Database Gateway for SQL Server provides support for stored procedures which return result sets.
By default, all stored procedures and functions do not return a result set to the user. To enable result sets, set the HS_FDS_RESULTSET_SUPPORT parameter value to TRUE.
PL/SQL Program Fetching from Result Sets in Sequential Mode
-- Execute procedure
out_arg := null;
refcurproc@MSQL('Hello World', out_arg, rc1);
Somewhere in this forum I've seen a message that the syntax "SELECT ... FROM sp@db(param1, param2)" works.
Anyway, even with the PL/SQL block the error message is the same - ORA-00933 "SQL command not properly ended"
and the cursor (* in SQL*PLUS) is put just at the first bracket.
Edited by: user636213 on Aug 10, 2012 5:17 AM -
User defined function in where IN clause
Hi,
I have a Function who returns in priview:
(1,2,3,4)
Now i am using this function in SQL where clause
Select from debug where id in debug.debug_process()
On execute select i am getiing ORA-01722 invalid number , i understand that functions return not only numbers but character symbols too '(,)'
Are it posible to use user defined function who do not return NUMBER in Where clause IN statement ? If not what tips can sugest me for getting list of values for use in IN Clause?
ID.
Thanks!Hi,
Please try:
You can use SYS REFCURSOR for return your data.
create or replace function get_debug return sys_refcursor is
v_rc sys_refcursor;
begin
open v_rc for 'select * from debug where id in '|| debug.debug_process();
return v_rc;
end;
Function created.
Now, if we look at using this through SQL*Plus we first create ourselves a ref cursor variable to accept the results of the function, and then call the function to get the ref cursor back..
SQL> var rc refcursor
SQL> exec :rc := get_debug ;
SQL> print rc;
Regards
Mahir M. Quluzade -
In which condition Table valued function should prefer over SP except use in joins?
Hi,
My requirements is:
Entity framework needs to call DB object (TVF or SP), which will provide some data to them and they'll work on it at app level.
DB object would be simple, one result set, it will join 5 tables and get around 30 columns to them. it would be parameterized query so can't use view.
Now my question is what DB object would be best to use, table valued function or store procedure. and why?
I google on it, I find some interesting links (example http://technet.microsoft.com/en-us/library/ms187650(v=sql.105).aspx)
they mentioned conditions to convert SP to TVF but not mentioned the reason, why I should convert?
Both have same cache plans strategy. SP has so many advantages over TVF, but I don't see any technical advantage of TVF over SP except it can be use in joins or so.
so In short my question is, why I can't use SP in all cases, why I would use TVF?, and which Table valued or multi-valued?
would appreciate your time and response.According to a few recent blogs you should be able to use TVP or stored procedure with EF 6.1.2 with ease. In our application we haven't switched yet to 6.1.2 (we're using 6.0.0) and there is no support for stored procedures or functions so we use StoreQuery.
I am wondering if you can share your experience of using EF with SP or TVP (and document the steps).
I am also wondering as how exactly it's working behind the scenes and where the full query is taking place. Say, in our case we may want to add some extra conditions after retrieving a set using, say, SP. Would the final query execute on the client (e.g.
SP executed on the server, result returned and then extra conditions executed on the "client")?
As I said, right now we're using StoreQuery which means that our extra conditions must be case - sensitive as opposed to SQL Server case insensitive. So, if someone already tried that scenario and can tell me how exactly it works, I would appreciate it.
Another question about EF - I defined a property as
[Column(TypeName = "varchar")]
public string PhoneNumber { get; set; } // area code + phone
and in the LINQ query as
var query = db.Accounts.Select(a => new AccountsList
AcctName = a.AcctName,
Contact = a.Contact,
FullName = a.FullName,
AreaCode = a.AreaCode,
Phone = a.Phone,
Hidden = a.Hide,
Hide = a.Hide,
PhoneNumber = a.AreaCode.Trim() + a.Phone.Trim(),
AcctTypeId = a.AcctTypeId
and I see that it's translated into CASE AreaCode IS NULL THEN N'' ELSE RTRIM(LTRIM(areaCode)) END + ...
My question is - why EF does it if there is no mentioning at all in the class as how NULL is supposed to be treated. Is it a bug?
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
How to declare variable in table valued function
hello.
i have the following code to define a inline table valued function
but the use of cmn.ReshteId('Lf_WL') as a function in where clause is not good performance.
Alter function lf.fn_WholeLifeBn_GetForm(@ViewKind tinyint, @CurrentLocation int) returns table
as
return
select B.*
from lf.fn_LifeBN_GetForm(@ViewKind, @CurrentLocation) B
where Reshte = cmn.ReshteId('Lf_WL')
for better performance following code is good:
declare @Reshte smallint
set @Reshte = cmn.ReshteId('Lf_TS')
select B.*
from lf.fn_LifeBN_GetForm(@ViewKind, @CurrentLocation) B
where Reshte = @Reshte
but can not use it as the first code block in inline function.
please help for define a good function.What do you think about Multi-Statement Table-Valued UDFs?
create function Func(@Var int)
returns @T table(ColName int)
as
begin
insert into @T(ColName) values (@Var)
return
end
select * from Func(10)
select * from Func(20)
---or
alter function Func()
returns @T table(ColName int)
as
begin
declare @Var int
set @Var = 10
insert into @T(ColName) values (@Var)
return
end
select * from Func()
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 -
SQL: Issue with running out of storage on server when running table-valued function
SQL Version: 2008 (not r2)
Problem: I'm getting the following error message when running a table-valued function:
Msg 1105, Level 17, State 2, Line 1
Could not allocate space for object 'dbo.SORT temporary run storage: 141072001204224' in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files
to the filegroup, or setting autogrowth on for existing files in the filegroup.
Request: Could anyone tell me if there are modifications that I could make to my SQL code to avoid this storage issues?
Thanks,
....bob sutor
Code Facts:
The JCCD table is a large table 2MM records
The other tables in the JOINS are very small 15 records or less
SQL Function Code:
ALTER FUNCTION [dbo].[xcft_XAWP_GLBalance_JCCD_Detail]()
RETURNS @JCGLDetail TABLE
JCCo tinyint
, Job varchar(10)
, PostingSource varchar(10)
, CostToDate numeric(12,2)
, Phase varchar(20)
, EarnType smallint
, LiabilityType smallint
, CostType tinyint
, ControllingSetting varchar(30)
, GLAccountCharged varchar(20)
, DeptNum varchar(10)
, DeptDesc varchar(30)
, JCDC_CostType tinyint
, CostTypeGL_Open varchar(20)
, CostTypeGL_Closed varchar(20)
, JCDO_ExcludePR varchar(1)
, JCDO_Phase varchar(20)
, PhaseGL_Open varchar(20)
, PhaseGL_Closed varchar(20)
, JCDL_LiabType smallint
, LiabTypeGL_Open varchar(20)
, LiabTypeGL_Closed varchar(20)
, JCDE_EarnType smallint
, EarnTypeGL_Open varchar(20)
, EarnTypeGL_Closed varchar(20)
AS
BEGIN
DECLARE
@WIPMonthCurrent date
SET @WIPMonthCurrent = (Select TOP 1 WIPMonth FROM udxcWIPMonths WHERE ActiveWIPPeriod = 'Y')
INSERT INTO @JCGLDetail
JCCo
, Job
, PostingSource
, CostToDate
, Phase
, EarnType
, LiabilityType
, CostType
, DeptNum
, DeptDesc
, JCDC_CostType
, CostTypeGL_Open
, CostTypeGL_Closed
, JCDO_ExcludePR
, JCDO_Phase
, PhaseGL_Open
, PhaseGL_Closed
, JCDL_LiabType
, LiabTypeGL_Open
, LiabTypeGL_Closed
, JCDE_EarnType
, EarnTypeGL_Open
, EarnTypeGL_Closed
SELECT
JCCD.JCCo, JCCD.Job, JCCD.Source, sum(JCCD.ActualCost) AS CostToDate, JCCD.Phase, JCCD.EarnType, JCCD.LiabilityType, JCCD.CostType
, JCDM.Department, JCDM.Description
, JCDC.CostType AS JCDC_CostType, JCDC.OpenWIPAcct AS CostTypeGL_Open, JCDC.ClosedExpAcct AS CostTypeGL_Closed
, JCDO.ExcludePR AS JCDO_ExcludePR, JCDO.Phase AS JCDO_Phase, JCDO.OpenWIPAcct AS PhaseGL_Open, JCDO.ClosedExpAcct AS PhaseGL_Closed
, JCDL.LiabType AS JCDL_LiabType, JCDL.OpenBurdenAcct AS LiabTypeGL_Open, JCDL.ClosedBurdenAcct AS LiabTypeGL_Closed
, JCDE.EarnType AS JCDE_EarnType, JCDE.OpenLaborAcct AS EarnTypeGL_Open, JCDE.ClosedLaborAcct AS EarnTypeGL_Closed
FROM JCCD
LEFT JOIN JCJP ON JCCD.JCCo = JCJP.JCCo AND JCCD.Job = JCJP.Job
LEFT JOIN JCCM ON JCJP.JCCo = JCCM.JCCo AND JCJP.Contract = JCCM.Contract
LEFT JOIN JCDM ON JCCM.JCCo = JCDM.JCCo AND JCCM.Department = JCDM.Department
LEFT JOIN JCDC ON JCDM.JCCo = JCDC.JCCo AND JCDM.Department = JCDC.Department AND JCCD.CostType = JCDC.CostType
LEFT JOIN JCDE ON JCDM.JCCo = JCDE.JCCo AND JCDM.Department = JCDE.Department AND JCCD.EarnType = JCDE.EarnType
LEFT JOIN JCDO ON JCDM.JCCo = JCDO.JCCo AND JCDM.Department = JCDO.Department AND JCCD.Phase = JCDO.Phase
LEFT JOIN JCDL ON JCDM.JCCo = JCDL.JCCo AND JCDM.Department = JCDL.Department AND JCCD.LiabilityType = JCDL.LiabType
LEFT JOIN xcft_XAWP_FiscalPeriodCutoffs_ForWIPMonth() AS cutoffs ON JCCD.JCCo = cutoffs.GLCo
WHERE
JCCD.Mth <= cutoffs.FiscalYear_LastMonth
AND JCCD.Job IN(SELECT JobNum FROM budxcWIPData_SQL WHERE WIPMonth = @WIPMonthCurrent)
AND JCCD.JCCo IN(SELECT JCCo FROM JCCO WHERE udExcludeFromWIP <> 'Y' or udExcludeFromWIP IS NULL)
--AND LTRIM(RTRIM(JCCD.Job)) = '71-'
GROUP BY
JCCD.JCCo, JCCD.Job, JCCD.Source, JCCD.Phase, JCCD.EarnType, JCCD.LiabilityType, JCCD.CostType
, JCDM.Department, JCDM.Description
, JCDC.CostType, JCDC.OpenWIPAcct, JCDC.ClosedExpAcct
, JCDO.ExcludePR, JCDO.Phase, JCDO.OpenWIPAcct, JCDO.ClosedExpAcct
, JCDL.LiabType, JCDL.OpenBurdenAcct, JCDL.ClosedBurdenAcct
, JCDE.EarnType, JCDE.OpenLaborAcct, JCDE.ClosedLaborAcct
UPDATE @JCGLDetail
SET
ControllingSetting =
CASE WHEN Phase = JCDO_Phase AND JCDO_ExcludePR = 'N' THEN 'PhaseOverride-PR Excluded'
WHEN Phase = JCDO_Phase AND JCDO_ExcludePR = 'Y'
AND EarnType NOT IN(Select EarnType FROM JCDE WHERE JCDE.JCCo = JCCo AND JCDE.Department = DeptNum)
AND LiabilityType NOT IN(Select LiabType FROM JCDL WHERE JCDL.JCCo = JCCo AND JCDL.Department = DeptNum)
THEN 'PhaseOverride-PR Not Excluded'
WHEN EarnType = JCDE_EarnType THEN 'Earn Type Override'
WHEN LiabilityType = JCDL_LiabType THEN 'Liability Type Override'
ELSE 'Cost Type' END
UPDATE @JCGLDetail
SET
GLAccountCharged =
CASE WHEN ControllingSetting = 'PhaseOverride-PR Excluded' OR ControllingSetting = 'PhaseOverride-PR Not Excluded'
THEN PhaseGL_Open
WHEN ControllingSetting = 'Earn Type Override' THEN EarnTypeGL_Open
WHEN ControllingSetting = 'Liability Type Override' THEN LiabTypeGL_Open
ELSE CostTypeGL_Open END
RETURN
END
Bob Sutorwell, did you either restart the instance or add another tempdb file (no restart required) to let other transactions continue on the server.
or check if autogrowth was limited, change that to unlimnited , to the transactions conintue..
the function may be dumping the data on to tempdb, how much data are you excepting back...what are indexes on the tables
Hope it Helps!! -
How to use Copy-Value function?
Dear Friends,
I have query on how to use Standard function Copy-Value.
Please have a look @ the help.sap.com example use of Copy-Value function.
http://help.sap.com/saphelp_nw70/helpdata/en/26/d22366565be0449d7b3cc26b1bab10/content.htm
I have designed the same example. Please see the mapping I've defined for this example :
http://www.flickr.com/photo_zoom.gne?id=930440086&size=o
Please see the resuts, its working perfectly. See the top image :
http://www.flickr.com/photo_zoom.gne?id=930440300&size=o
Ok, now lets come to the issue. Please consider the same example , If I have more than one partner
and I want to use the address field to the customer street,city & zipcode using copy-value function, how will I achieve this?
Please see the resuts.See the bottom image :
http://www.flickr.com/photo_zoom.gne?id=930440300&size=o
I think you all got the issue, if not please reply back.
Looking for your answers!!!
Best regards,
raj.The CopyValue function considers only values in the first context of the queue.
When the queue has more contexts, the other contexts are ignored.
In online help, the element addrDat is 3 times under name, that means 3 values are in the first context.
That means: For the first occurrence of the partner it is correct, for all other partners, the values of the first context is taken. The online help does not express this, so it is misleading and should be changed to an example where address is not beyond a node with occurrence inbounded.
In practical cases the copyValue can only be used for values that appear in source just one time, like the IDOC header fields, as it works like a constant.
Regards
Stefan -
CBO and functions in the WHERE clause
Hi,
Can anyone point me to any documents describing how the cost based optimizer treats functions in a WHERE clause?
For example, in
select ...
from ...
where ...
and my_package.my_function( t.some_column ) = 'Y'
...does the CBO treat "my_package.my_function" as a black box or does it go into the body of "my_package.my_function" and take into consideration the associated costs of all the SELECT statements in the function?
I've tried a few simple tests to answer the question, but I've received conflicting results. Has anyone had any experience with this?
Thanks in advance for your help.Thanks for the info. Justin.
<br><br>
I think I've solved my problem, but I'll repeat it here in case it helps anyone else. Here is a very simplified example of what I was seeing.
<br><br>
A query like this:
select
a.party_id, b.cust_account_id
from
hz_parties a,
hz_cust_accounts b
where
a.party_id = b.party_id
and mis_hz_merge_veto_pkg.party_merge_will_be_vetoed(a.party_id) = 'N'was returning a drastically different execution plan than this
select
a.party_id, b.cust_account_id
from
hz_parties a,
hz_cust_accounts b
where
a.party_id = b.party_id
and mis_hz_merge_veto_pkg.account_merge_will_be_vetoed(b.cust_account_id) = 'N'I initially thought the difference was due to the fact that I was using different functions in the last line, but then I tried this version
select
a.party_id, b.cust_account_id
from
hz_parties a,
hz_cust_accounts b
where
a.party_id = b.party_id
and mis_hz_merge_veto_pkg.party_merge_will_be_vetoed(b.party_id) = 'N'and found that it gave me a different execution plan than the first SELECT as well, even though it used the same function. The difference seems to stem from the columns I use in the function parameter and not the choice of function. -
How can I set a variable number of values in a SQL IN clause?
Hi,
How can I set a variable number of values in a SQL IN clause without having to change the text of the SQL statement each time?
I read the link http://radio.weblogs.com/0118231/2003/06/18.html. as steve wrote.
SELECT *
FROM EMP
WHERE ENAME IN (?)
But we need the steps not to create type in the system and would there be any other solution if we would like to use variable number of values in a SQL IN clause ?
We are using JDeveloper 10.1.3.2 with Oracle Database 10.1.3.2
Thanks
RajHi,
can you please explain why the solution from steve is not the right solution for you.
regards
Peter -
JDBC Adapter Call a Table-Valued Function
Hello to all,
we're using the JDBC adapter to access a MS SQL-Server 2008.
I have to call a "Table-Valued Function" via JDBC.
Has anybody done this?
I've tried to call it like a stored procedure with the following:
<ns1:LGBuchungSAP_REQ xmlns:ns1="http://xyz.de/pi/mav/kantine">
<fLGBuchungenSAP>
<Tablename action="execute">
<table>dbo.fLGBuchungenSAP</table>
</Tablename>
</fLGBuchungenSAP>
</ns1:LGBuchungSAP_REQ>
but I get following error:
com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser:
Error when executing statement for table/stored proc. 'dbo.fLGBuchungenSAP' (structure 'fLGBuchungenSAP'): com.microsoft.sqlserver.jdbc.SQLServerException:
Fehler bei der Anforderung für 'fLGBuchungenSAP' (Prozedur), weil 'fLGBuchungenSAP' ein Tabellenwertfunktion-Objekt ist.
Calling with a select-statement also fails:
<ns1:LGBuchungSAP_REQ xmlns:ns1="http://xyz.de/pi/mav/kantine">
<STATEMENT_NAME>
<Tablename action="SELECT">
<table>dbo.fLGBuchungenSAP('20101101 00:00:00', '20110101 00:00:00')</table>
</Tablename>
</STATEMENT_NAME>
</ns1:LGBuchungSAP_REQ>
with error:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Eingangs-Message -->
<SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>XIAdapterFramework</SAP:Category>
<SAP:Code area="MESSAGE">GENERAL</SAP:Code>
<SAP:P1></SAP:P1>
<SAP:P2></SAP:P2>
<SAP:P3></SAP:P3>
<SAP:P4></SAP:P4>
<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'dbo.fLGBuchungenSAP('20101101 00:00:00', '20110101 00:00:00')' (structure 'STATEMENT_NAME'): java.lang.IndexOutOfBoundsException: Index: 4, Size: 4</SAP:AdditionalText>
<SAP:Stack></SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Please advice
Regards
ChristianHello to all,
I solved the problem.
You have to call it this way:
<ns1:LGBuchungSAP_REQ xmlns:ns1="http://xyzde/pi/mav/kantine">
<STATEMENT>
<LGBuchungSAP action="SQL_DML">
<access>select * from dbo.fLGBuchungenSAP('$DatumVon$', '$DatumBis$')</access>
<key>
<DatumVon>20101101 00:00:00</DatumVon>
<DatumBis>20110101 00:00:00</DatumBis>
</key>
</LGBuchungSAP>
</STATEMENT>
</ns1:LGBuchungSAP_REQ>
But I get the next error: "A result set was generated for the update task"
<SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
<SAP:Category>XIAdapterFramework</SAP:Category>
<SAP:Code area="MESSAGE">GENERAL</SAP:Code>
<SAP:P1></SAP:P1>
<SAP:P2></SAP:P2>
<SAP:P3></SAP:P3>
<SAP:P4></SAP:P4>
<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'LGBuchungSAP' (structure 'STATEMENT'): com.microsoft.sqlserver.jdbc.SQLServerException: Es wurde ein Resultset für den Aktualisierungsvorgang generiert.</SAP:AdditionalText>
<SAP:Stack></SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error> -
Call a function in a where clause of a select
hello,
is it possible to call a function in a where clause of a select????
ex: select col1, col2
from my_table
where my_package.my_function(32199, 2008, col3, 'P');
and i have error message "ORA-00920: invalid relational operator"
FUNCTION my_function(v_matricule IN NUMBER,
v_Year IN NUMBER,
v_date IN DATE,
v_type IN CHAR DEFAULT 'P')
RETURN BOOLEAN;
@+Rosagiouser10225229 wrote:
hello,
is it possible to call a function in a where clause of a select????
ex: select col1, col2
from my_table
where my_package.my_function(32199, 2008, col3, 'P');
and i have error message "ORA-00920: invalid relational operator"
FUNCTION my_function(v_matricule IN NUMBER,
v_Year IN NUMBER,
v_date IN DATE,
v_type IN CHAR DEFAULT 'P')
RETURN BOOLEAN;You can call a function if it returns a datatype that is supported by SQL. BOOLEAN is NOT supported by SQL. -
Calling User definedTable valued function in Select
Hello,
I Created a UserDefined Table Valued Function in HANA.
I need to call it in Select Statement Statement.
For Example
Select Func(col1) as test,col2 from tablename;
While using UserDefined Table Valued Function in above select statement
I am getting following error
cannot use procedure or table function in select projection
Please help meDont think you can do that Krishna,
A Tabel UDF is expected to return a row of results and not just a scalar value. A SELECT <value> on the other hand can only expect a single value. Maybe you could try SELECT (SELECT TOP 1 <column name> from TABLEUDF() ) from....
Regards,
Nehal. -
SQL CLR Table-Valued Function System.NullReferenceException
Good day.
I wrote a clr table-valued function that gets the data from the sharepoint list using the client model.
Sometimes I get exception (When I calling this function I get 90000 rows and then I get this exception...):
Msg 6260, Level 16, State 1, Line 1
An error occurred while getting new row from user defined Table Valued Function :
System.NullReferenceException: Object reference not set to an instance of an object. System.NullReferenceException: v at SDS.FillRow(Object obj, SqlInt32& month, SqlString& datePlanSalary, SqlString& dilerCode, SqlString& dilerName, SqlString&
model, SqlInt32& countSalary).
How can I fix this issue?
My Code:
public class SDS
[SqlFunction(SystemDataAccess = SystemDataAccessKind.Read, FillRowMethodName = "FillRow")]
public static IEnumerable SDSItems(SqlString url, SqlString listName)
ClientContext context = new ClientContext(url.ToString());
List list = context.Web.Lists.GetByTitle(listName.ToString());
CamlQuery query = new CamlQuery();
query.ViewXml = "<View/>";
ListItemCollection listItems = list.GetItems(query);
context.Load(list);
context.Load(listItems);
context.ExecuteQuery();
return listItems;
public static void FillRow(
object obj,
out SqlInt32 month,
out SqlString datePlanSalary,
out SqlString dilerCode,
out SqlString dilerName,
out SqlString model,
out SqlInt32 countSalary
item = (ListItem)obj;
month = Convert.ToInt32(item["_x041c__x0435__x0441__x044f__x04"]);
datePlanSalary = Convert.ToString(item["_x0414__x0430__x0442__x0430__x000"]);
dilerCode = Convert.ToString(item["_x041a__x043e__x0434__x0020__x04"]);
dilerName = Convert.ToString(item["_x041d__x0430__x0437__x0432__x04"]);
model = ((FieldLookupValue)item["_x041c__x043e__x0434__x0435__x04"]).LookupValue;
countSalary = Convert.ToInt32(item["_x041a__x043e__x043b__x0438__x04"]);That's not a lot of information to go on, but...
Can you put a check in your FillRow method for a null object (or one of your fields being null) and put out diagnostic information? Or is it happening in the ListItemCollection iterator itself? (i.e. before it returns a row back to FillRow). If it's happening
in the iterator, perhaps you could subclass it and return diagnostics at that point.
I'm also wondering (if it actually always happen at row 90000) if you're hitting a limit in web service call, or iterator, or UDF code. Does the function ever return more than 90000 rows successfully?
Hope this helps, Bob -
I have problems for to use Start function inside a case structure.
I am doing data acquisition using the Config, Start and Read functions, all them inside a while loop. I want to use Config function only when certain conditions occur, so I put the function inside a case and no problem. But when I put the start function inside the same case, the acquisition is not good. Please view my attachment. My application is client-server type.
Attachments:
scope_server(config_start).vi 160 KBBoxer,
I checked your example and have several easy but important suggestions for you:
1.- First, make sure that the first time you initialize the VI, the AI Config and AI Start are executed, because based on the debug I made, your program doesn't do it, and this is very important.
2.- Add an AI Clear after the acquisition is done, so that you release the resources. This is a good programming technique, and may help you solve your issue.
3.- Add an Error Cluster, so that you know if an error occurred at some point of the acquisition. This will help you track the issue.
4.- What do you mean by "the acquisition is not good". What does it happen? What does it do? Do you get an error? <- This is the reason of step 3.
5.- Finally, if you have doubts
programming AI, check one of the shipping examples of LV. They can give you a much clearer idea.
Hope this helps,
L Aguila
Applications Engineeer
National Instruments
Maybe you are looking for
-
How do I activate a used iPhone 3 with no SIM card for use as an ipod touch?
How do I activate a used iPhone 3G with no SIM card for use like an iPod Touch? It was apparently on AT&T previously and I have another iPhone 3 that is active on AT&T if that is helpful. Thanks!
-
Greetings. Tonight, as I walked home from work listening to my relatively new (and nearly full) 40GB iPod (which was just sitting in my pocket) as always, the music stopped. The iPod looked fine, but when I went to start playing music again, it skipp
-
i have a pdf form whcih has few fields that i fill from C# using the ItextSharp, the problem is that the field filled in the pdf form cannot be read by Adobe View Read Out Loud feature in correct order and the Jaws cannot read the text filled i
-
"Reveal in Finder" Disappeared
About 2 weeks or so ago my "Reveal in Finder" in my right click menu disappeared, does anyone know how to get it back? I am on a MacBook Pro running 10.6.8 all up to date.
-
Issues with 'Mute' in Audio Track
Hi All 1. Using Premiere Pro CC (Fully Up to Date) Was wondering if I could get assistance with what I believe is an issue with the Mute Button in an Audio Track. Firstly my understanding is that, if I use the 'Mute' button either in the Audio Mixer