Use of SQL COLLATE functionality in IS
Hi!
In the developing of our Business Rules we have a validation that checks that the NAME1 for Customers is always entered in Upper Case letters.
The issue is that not all our customers are entered in Latin Characters, so we use to have a function in our WHERE condition in SQL to handle this
NAME1 COLLATE Latin1_General_CS_AS <> UPPER(NAME1)
Is there any way to do this or something similar to this inside Information Steward? We would love to be able to handle this inside the Rule development in IS and don't have to handle it by Data Base view or something similar.
Thanks!!
Alberto Páez
Hello Alberto ,
Did you manage to find solution to the above issue ? I do have a similar scenario with vendor master where I am trying to fail all vendors which do not have all letters in upper cases .
Please advise .
Similar Messages
-
Problem with "&#34" using PL/SQL extract function ( XMLTYPE)
Hi,
When I use extract function (PL/SQL), it does not transform well """. Insted of returning ' " ' , it returns ' " '.
I know this works changing the code replacing xml.extract for SELECT extractvalue(xml,'//A/text()') into v from dual;
But Is there another way to do this using PL/SQL? any patch, option..?
RegardsHi,
cursor proct is select * from proc22;
cursor proct5 is select *from proc24;
fetch proct into proctval;
fetch proct5 into proctval5;
if proct.symbol=proct5.symbolThat's strange to join two tables like this. You will have chance if you enter in your if condition.
Why not create only one cursor with this join condition on the two tables ?
re5:=re5/proctval.previousprice5;Furthermore, what do you make with r5 variable ? It seems nothing to do. Your proc does no much job.
What do you want to achieve exactly ?
Nicolas. -
Use of sql group function in orcl:query-database - urgent
All,
Version: 10.1.3.4
Two requirements for me:
1. I want to use sum function in orcl:query-database. How to use it?
For ex: I tried the following
<xsl:value-of select='orcl:query-database("select sum(salary) from emp",false(),false(),"jdbc/DB1")'/>
I got the following error
oracle.xml.sql.OracleXMLSQLException: Character ')' is not allowed in an XML tag name.
When I tried without sum function, it works fine
2. I used the same table, but without the sum function as below
<xsl:value-of select='orcl:query-database("select salary from emp",false(),false(),"jdbc/DB1")'/>
This time, it returns the first employees salary!! I dont understand this logic. I expected either the query returns all the rows else it throws error, but none of them were true!
Can anyone pls explain what is the behavior? I want your reply for both the queries!
Currently I'm in a project where I'm working in the similar scenario, so please guru's let me know ASAP.
Thanks,
SenHi Sen,
Create a normal variable variable in XSLT.
Then use that variable.
I mean variable name='Var_1' select='Your Query'
Now use Var_1/yourcollection/...
I am giving some example
<xsl:variable name="Stopdetails" select="/ns0:MyEBM/ns0:DataArea/ns0:MyEBO/ns0:Stops/ns0:Stop[ns0:StopID=$TempStopId]"/>
<xsl:variable name="AccStopTypeVar">
<xsl:value-of select="$Stopdetails/ns0:StopType"/>
</xsl:variable>If you want you can loop on the created variable.
You can do these in XSL.
But DB calls those things ...it would be better , if u take them out. Spme debugging problems are there with XSL.
Regards
PavanKumar.M -
Query of queries disallows SQL right() function
We're attempting to do a query of queries using the SQL
right() function like this:
select *
from getresults
where right([key],charindex('\',reverse([key]),1)-1) not in
(#quotedvaluelist(getexcluded.file_name)#)
We've even replaced that where clause with a much more simple
where right([key])='m'
just to make sure that it wasn't the nesting functions that
were causing the problem.
In either case, we get the error:
Query of Queries syntax error.
Encountered "right" at line 0, column 0. Incorrect
conditional expression,
Expected one of [like|null|between|in|comparison] condition,
What SQL functions are disallowed from query of queries?
Thanks,
KrisNasty stuff huh. Just happened to discover myself today that
Left doesn't work. I'd suspect that Aggregate functions are the
ONLY ones that will work. It would have been nice if they'd at
least allowed CF vs DB functions in their own "database" language.
BTW, also discovered that Count() returns Null rather than 0
when there aren't any per your WHERE clause. -
Using a SQL user-defined function in Crystal Reports XI
Post Author: JoannKarp
CA Forum: Formula
Is it possible to use a user defined function in SQL and use this in multiple Crystal reports?
JoannKarpSELECT COALESCE(ufn_GetAddressByBusinessEntityIDandAddressTypeID(table1.BusinessEntityID,712),ufn_GetAddressByBusinessEntityIDandAddressTypeID(table1.BusinessEntityID,712)) AS Zipcode
FROM table1
Nope. This is two function calls. coalesce(a, b, c, ...) is just syntatic sugar for
CASE WHEN a IS NOT NULL THEN a
WHEN b IS NOT NULL THEN b
WHEN c IS NOT NULL THEN c
END
But if you use isnull it's a different matter. (But isnull() permits two arguments.)
Erland Sommarskog, SQL Server MVP, [email protected] -
Function 'myfunc' may not be used in SQL Options
<p>
Hello,
I have created a simple function in a packege for use in an update statement. The function is
FUNCTION myfnc(p1 IN t1.c1%TYPE)
RETURN VARCHAR2
IS
BEGIN
IF p1 = 3 THEN
RETURN 'A';
ELSE
RETURN 'B';
END IF;
END myfnc;
I use it in a procedure which exists in the same package as the function as follows
Update t1
set c1 = myfnc(c2);
I am getting the compliation error Function 'myfunc' may not be used in SQL.
There is no db manipulation going on and I have tried using
PRAGMA RESTRICT_REFERENCES (myfnc, WNDS, WNPS, RNDS, RNPS);
but to no avail.
One other thing is that I thought this was compiling OK but then I decided to put the function in the package specification so I could unit test it using a db call. Now if I drop and recreate the package without the declaration in the specification the compile error still occurs. Perhaps that's my mind playing tricks but maybe there is something here I am not aware of.
Any suggestions?
</p>Hi,
You found the solution.
Although it's allowed to say
Update t1
set c1 = local_var;in a package, where local_var is not defined outside of the procedure, let alone the package, and
although it's legal to say:
local_var = myfnc (some_other_var); inside the package where myfnc is a private function (included in the package body, but not in the package header), still
it is not legal to say:
Update t1
set c1 = myfnc (c2); If there is a problem with putting myfnc in the package header (for example, you don't want people calling it directly, for some reason), you can make it a stand-alone function, like Someoneelse did, or put in a different package, and give the owner of your first package (and no one else) EXECUTE privileges on it.
As William pointed out, if myfnc is really this simple, you might not need a function at all. -
Function name_function may not be used in SQL
Dear forums,
when i compiled my form that contain the function package, i got the error "Function <name_function> may not be used in SQL". But when i execute the function from sql plus, it works smoothly.
What's the solution ?
with great thanks,Hi Salim,
as far as I understand you you try to use a function that is stored in the form. The select statement is worked on the database where your function is not known. You have to create this function on the database as you did it for using in SQLPlus.
Regards,
Werner -
Equivalent of to_date function in Ms SQL and using it in Evaluate function
Hi,
I am trying to find out a function in MS SQL which is equivalent to to_date function in oracle. Please find below the advanced filter i am trying to use in OBIEE.
Evaluate('to_date(%1,%2)' as date ,SUBSTRING(TIMES.CALENDAR_MONTH_NAME FROM 1 FOR 3)||'-'||cast(TIMES.CALENDAR_YEAR as char(4)),'MON-YYYY')>=Evaluate('to_date(%1,%2)' as date,'@{pv_mth}'||'@{pv_yr}','MON-YYYY') and Evaluate('to_date(%1,%2)' as date ,SUBSTRING(TIMES.CALENDAR_MONTH_NAME FROM 1 FOR 3)||'-'||cast(TIMES.CALENDAR_YEAR as char(4)),'MON-YYYY') <=timestampadd(sql_tsi_month,4,Evaluate('to_date(%1,%2)' as date,'@{pv_mth}'||'@{pv_yr}','MON-YYYY'))
The statement above works fines with oracle DB with to_date function. The same statement throws an error with MS SQL since to_date is not a built in function.
With MS SQL I tried with CAST, not sure how to pass parameters %1 and %2.
Please help me how to use Evaluate function and passing parameters along with to_date funtion in MS SQL.
Regards!
RRHi,
please refer to this thread for useful information on using to_char and to_date functions of oracle in MS SQL server:
http://database.ittoolbox.com/groups/technical-functional/sql-server-l/how-to-write-to-to_char-and-to_date-sql-server-351831
Hope this helps.
Thanks,
-Amith. -
Out of pure curiosity : is it possible to use a SQL function in a DSV?
Hi all :)
out of pure curiosity, I asked myself about this : is it possible using a function in a named query for exemple?
This is why I would know that : there is a difficult function in the database. I don't want to make a view to use it and to have the table I want. I would use it directly in the dsv, with a named query (or other thing?).
I thank you a lot by advance.
(I use SQL Server 2008 :) )
See youHello,
In a named query for a Report you can use any valid SQL Statement; so yes, you can use system/user defined functions in your query.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
Using PL/SQL code in ODI User Functions
Is it possible to write PL/SQL code (with multiple in params and one out param) in ODI User Function ?
Actually I need to use this user functions in my interface mapping.
I know it can be done using ODI Procedures but Procedures cannot be used within interfaces when mapping columns.Hi Anurag Ambasta,
You can use the ODI user functions and choose the Linked technology as 'Oracle' where you can implement and use oracle syntax .
And the user functions can receive the multiple parameters and it returns the single value to the function cal, which use are expecting right?
Thanks,
Yellanki -
Use of Pl/Sql and Function
Hi,
Can we use a PL/Sql package or a Function in a sql query. If yes How.??
Regards
SameerSameer8 wrote:
Can we use a PL/Sql package or a Function in a sql query. If yes How.??A function (whether declared in a package or a stand alone stored function) may be used in SQL providing it does not contain any OUT parameters...
SQL> create function testf(x OUT number) return number is
2 begin
3 x := 1;
4 return 2;
5 end;
6 /
Function created.
SQL> var my_x number
SQL> select testf(:my_x) from dual;
select testf(:my_x) from dual
ERROR at line 1:
ORA-06572: Function TESTF has out argumentsAnd it doesn't do any DML...
SQL> create table x (x number);
Table created.
SQL> ed
Wrote file afiedt.buf
1 create or replace function testf return number is
2 begin
3 insert into x values (1);
4 return 1;
5* end;
SQL> /
Function created.
SQL> select testf() from dual;
select testf() from dual
ERROR at line 1:
ORA-14551: cannot perform a DML operation inside a query
ORA-06512: at "SCOTT.TESTF", line 3 -
Using pl/sql functions for transformation
How can I use pl/sql functions in the transformation mapping field for my interface?
I have a name field where firstname and lastname are concatenated via a space-character and I would like to extract this 'name' field to 2 separate database attributes.
This means that I need to use a function that uses SUBSTRING and INSTR to be able to get the firstname and lastname separatly out of the name-field.
The INSTR-function isn't known inside the expression editor in ODI so I'm wondering how I can use my own function?Hi Romanna,
Are you sure? Where did you do your transformation?
-Source, Staging area or Target
I try this on Oracle target...
FIRST_NAME = substr(MYTABLE.FIRST_LASTNAME, 1, instr(MYTABLE.FIRST_LASTNAME, ' ')-1)
LAST_NAME = substr(MYTABLE.FIRST_LASTNAME,instr(MYTABLE.FIRST_LASTNAME, ' ')+1) -
Creating optional elements using SQL / XML functions
Hi,
I am struggling with some SQL / XML functionality in order to create some optional elements in a XMLType.
I have one table with data to be generated into an XML document. The table looks like this (only the attributes related to the problem are shown):
msg_id (pk)
geslacht_hoofdverzekerde
geboortedatum_hoofdverzekerde
geslacht_medeverzekerde
geboortedatum_medeverzekerde
I have to create an XML document that looks like this:
<ber:rekenparameters>
<ber:verzekerde>
<ber:codeRelatierol>HVZ</ber:codeRelatierol>
<ber:geslacht>M</ber:geslacht>
<ber:datumGeboorte>01-01-1960</ber:datumGeboorte>
</ber:verzekerde>
<ber:verzekerde>
<ber:codeRelatierol>MVZ</ber:codeRelatierol>
<ber:geslacht>V</ber:geslacht>
<ber:datumGeboorte>01-01-1961</ber:datumGeboorte>
</ber:verzekerde>
</ber:rekenparameters>
Where <ber:codeRelatierol> is hard coded: i.c. of hoofverzekerde 'HVZ' in case of medeverzekerde 'MVZ'.
Geslacht en datumGeboorte are taken form the table.
The element <ber:verzekerde> is obligatiry for hoofdverzekerde but optional for medeverzekerde: only in case geslacht_medeverzekerde and geboortedatum_medeverzekerde are not null this 2nd <ber:verzekerde> element has to be added.
I created the next SQL (I skipped some stuff in order to focus on the problem):
CREATE OR REPLACE
VIEW dps_v_berekening_berichten
AS
SELECT msg_id as msg_id
, XMLElement( "ber:berekening"
, XMLAttributes( 'http://www.w3.org/2001/XMLSchema-instance' AS "xmlns:xsi"
, 'http://www.mycompany.nl/berekenen' AS "xmlns:ber"
, 'http://www.mycompany.nl/berekenen http://www.mycompany.nl/berekenen/berekening.xsd' AS "xsi:schemaLocation"
, XMLElement( "ber:nummerRekenRegel"
, XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
, 1
, XMLElement( "ber:rekenparameters"
, XMLAttributes( 'http://www.mycompany.nl/berekenen' AS "xmlns:ber" )
, XMLElement( "ber:codeEvolutie" ) -- Empty
, XMLElement( "ber:verzekerde"
, XMLForest ( 'HVZ' AS "ber:codeRelatierol"
, xoa.geslacht_hoofdverzekerde AS "ber:geslacht"
, xoa.geboortedatum_hoofdverzekerde AS "ber:datumGeboorte"
, XMLElement( "ber:verzekerde"
, XMLForest ( 'MVZ' AS "ber:codeRelatierol"
, xoa.geslacht_medeverzekerde AS "ber:geslacht"
, xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
-- Some more elements.
) AS bericht
FROM DST_UP1_XML_OUTDATA xoa
The problem is that the XMLForest always creates an <ber:verzekerde> element for medeverzekerde. I tried to create an inline view with just the "vezekerde"attributes and conditionally joining this inline view with the dst_up1_xml_outdata table. That didn't solve my problem. Because in case of a medeverzekerde available it returned two XML documenst: one that included the hoofdverzekerde and one that included the medeverzekerde. And obviously that's not what I want.
I imagine I have to juggle with some of these SQL / XML functions although I cannot put the finger on the exact differences between some of these (XMLElement, XMLForest, XMLAgg, XMLSequence). The examples shown in de XML DB Developer's Guide don't seem to adress my problem.
Help !Hi, are you talking about this part that you don't want to be there? I am not so clear about your requirements.
XMLElement( "ber:verzekerde"
, XMLForest ( 'MVZ' AS "ber:codeRelatierol"
, xoa.geslacht_medeverzekerde AS "ber:geslacht"
, xoa.geboortedatum_medeverzekerde AS "ber:datumGeboorte"
If you want to control certain subelements so they don't appear, do not use xmlforest. Use xmlelement instead so it is easier to control it using case when. Mark (of Oracle, he should be here soon since OOW is over) showed me this technique and it helps tremendously, because oftentimes XDB will return an empty tag even though your consumers don't like it!
try something like this,
(case when xoa.geboortedatum_medeverzekerde = 'MVZ' then
xmlelement("ber:verzekerde",
xmlelement("What you want", colname),
xmlelement("ber:codeRelatierol", 'MVZ'),
(case when colname is not null or = some other value then
xmlelement("Rest", colname))
end)
end),
You may have to twig some details there. But the key is to use the case when construct to get rid of unwanted elements or empty elements. So you should only have the elements if you have a value of 'MVZ'. Hope this helps.
Ben -
Executing stored function using Native SQL
In SAP documentation, I can see how to execute an Oracle stored procedure in an external database using:
EXEC SQL.
EXECUTE PROCEDURE procname
ENDEXEC.
I want to execute a stored FUNCTION within a package. I have tried executing it using the syntax for PROCEDURE above and get a "ORA-06550 wrong type or number of arguments" error. Since the function has one argument in and one argument out, I think I am counting the number of arguments correctly. Has anyone executed from within ABAP an Oracle function stored in an external database?
Thanks
Janice IsheeJanice - from help.sap.com:
Stored Procedures
The command EXECUTE PROCEDURE proc allows you to call a procedure stored in the database. When you call it, you can pass a list of host variables as parameters. When yuo call a procedure, you must specify for each parameter whether it is an input parameter ( IN), output parameter (OUT) or changing parameter (INOUT).
Example
Calling a Procedure:
DATA Y TYPE I VALUE 300.
DATA Z TYPE I.
EXEC SQL.
INSERT INTO AVERI_CLNT (CLIENT, ARG1, ARG2, ARG3)
VALUES ('000', 9, 2, 47)
ENDEXEC.
EXEC SQL.
CREATE OR REPLACE PROCEDURE PROC1 (X IN NUMBER) IS
BEGIN
UPDATE AVERI_CLNT SET ARG3 = ARG3 + X;
END;
ENDEXEC.
EXEC SQL.
CREATE OR REPLACE PROCEDURE PROC2 (X IN NUMBER, Y OUT NUMBER) IS
BEGIN
SELECT ARG3 INTO Y
FROM AVERI_CLNT
WHERE CLIENT = '000' AND ARG1 = 9 AND ARG2 = 2;
UPDATE AVERI_CLNT SET ARG3 = ARG3 - X;
END;
ENDEXEC.
EXEC SQL.
EXECUTE PROCEDURE PROC1 ( IN :Y )
ENDEXEC.
EXEC SQL.
EXECUTE PROCEDURE PROC2 ( IN :Y, OUT :Z )
ENDEXEC.
IF SY-SUBRC <> 0 OR Z <> 347.
WRITE: / 'Wrong result for EXECUTE PROCEDURE:', Z.
ENDIF.
EXEC SQL.
DROP PROCEDURE PROC1
ENDEXEC.
EXEC SQL.
DROP PROCEDURE PROC2
ENDEXEC.
Rob -
Error using Extended SQL Function substr
I want to be able to look for the first three letters of a month in the XML and if found replace the 3 letter month (for example SEP-05 to September 05). I have tried the following which throw a namespace exception. Please let me know what I may be doing wrong?
1. <?if:(xdofx:substr(../fsg:ColContext[2]/fsg:ColHeadLine2,1,3)='SEP'?>September<?end if?> should give me September.
The above fails with: Font Dir: E:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
Run XDO Start
RTFProcessor setLocale: en-us
FOProcessor setData: E:\Work\Bacardi\Reports\XML\US GAAP BALSHEET\XML BL Dir Rpt BS YTD_0126.xml
FOProcessor setLocale: en-us
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at oracle.apps.xdo.common.xml.XSLT10gR1.invokeNewXSLStylesheet(XSLT10gR1.java:514)
at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:192)
at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:156)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:916)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:869)
at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:204)
at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1535)
at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:925)
at RTF2PDF.runRTFto(RTF2PDF.java:590)
at RTF2PDF.runXDO(RTF2PDF.java:443)
at RTF2PDF.main(RTF2PDF.java:237)
Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'xdofx' used but not declared.
at oracle.xdo.parser.v2.XSLProcessor.reportException(XSLProcessor.java:782)
at oracle.xdo.parser.v2.XSLProcessor.newXSLStylesheet(XSLProcessor.java:564)
... 15 more
2. For the year, I would use another form field and do something like this next to the month above: <?xdofx:substr(../fsg:ColContext[2]/fsg:ColHeadLine2,5,2)?> for a result of '05'Hasan
XSL has many native string manipulation functions so you do not need to use our SQL functions when a native XSL one will do:
<?if:substring(normalize-space(../fsg:ColContext[2]/fsg:ColHeadLine2),1,3)='SEP'?>September<?end if?>
See that dang normalize space function again ... had to use it on my FSG sample.
Would it not be easier to either:
1. Have the FSG generate the September YYYY format or
2. Have FSG generate XSD date formats, 'YYYY-MM-DD', then you can just specify the date format in the form fields
Regards, Tim
Maybe you are looking for
-
Error when I "submit Form" through Outlook 2007
We have a interviewer who is trying to use a new form we created. When she hits the "submit form" button she gets the normal prompts and then a email is placed in her outbox (using Outlook 2007). However, after a few moments she receieves an error co
-
Hi, I am facing one issue like, AR Dashboard not updating for jan 2010. But test of the dashboards are updated. I done update row count for AR table in Administrator. Replaced AR table in SQLYog. Any one please gudie me in this situation. Thanks EP
-
Hi, I had my iPhone 4S and I'm recently upgraded it from 7.0.5 to 7.0.6 and I found the battery drain up very fast if compare to iOS 7.0.5. Besides, I also unable to fully charger my phone to 100% now - max is 85% with phone either in airplane mode o
-
No Power Adaptor--How to Restore
I was trying to restore my old IPOD mini to factory settings. My problem is, in the second step I need to plug the Ipod into the power adaptor it originally came with, however I have lost it over the years. I really don't care if it is restored anymo
-
HT1750 The serial # is way too small to read!!!! Make it BIGGER!
The serial # is way too small to read!!!! Make it BIGGER!