Function CONCAT on JPQL

Hi everybody.
I'm currently working on a J2SE application and i'm using JPA as persistence framework, it works very fine, but when I try to do a query with a function CONCAT it came with an error:
+Caused by: Exception [TOPLINK-8025] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.EJBQLException
Exception Description: Syntax error parsing the query [SELECT CONCAT(CONCAT(d.nombre, ' ', CONCAT(d.apellidoPaterno, ' ') d.apellidoMaterno)) FROM Datospersonales as d, Personaljuzgado as p WHERE p.idDatosPersonales = d.idDatosPersonales ], line 1, column 8: unexpected token [CONCAT].
Internal Exception: line 1:8: unexpected token: CONCAT+
The statement in MySQL that I'm trying to do is :
+SELECT CONCAT(datospersonales.nombre, ' ', datospersonales.apellidoPaterno, ' ', datospersonales.apellidoMaterno )
FROM datospersonales, personaljuzgado
WHERE personaljuzgado.idDatosPersonales = datospersonales.idDatosPersonales;+
Any help will be grateful, thanx a lot :D

Oops, also JPQL BNF does not allow functions in the SELECT clause. Seems like a limitation of the Spec.
As a workaround you could just select the fields back and build the string in Java. Otherwise you could create a native query, or use a TopLink ReportQuery and Expressions directly (which does support functions in the Select clause).

Similar Messages

  • Cast and Concat functions error

    Hi
    I am getting below errors while doing cast and concat
    The error message is nQSError: 22020] Function Concat does not support non-text types.
    and my concat code is
    CAST (cast(day(current_date) as char)||'-'||month(current_date)||'-'||cast(year(Core."Dim - Date"."Date") as char) AS DATE )
    Error when tried it differently [nQSError: 27002] Near <)>: Syntax error [nQSError: 26012] .
    CAST (concat(cast(day(current_date) as char)||'-'||month(current_date)||'-'||cast(year(Core."Dim - Date"."Date") as char)) AS DATE )
    Please suggest.

    Hi,
    CASE WHEN Core."Dim - Date"."Year" = 'year(current_date)' THEN FILTER( AGO(Core."Fact - Spend and AP Invoice Distribution"."Spend YTD", Core."Date"."Year", 1)
    USING Core."Dim - Date"."Date" = VALUEOF(NQ_SESSION."R_Current_Date")) WHEN Core."Dim - Date"."Year" <> 'year(current_date)' THEN FILTER( AGO(Core."Fact - Spend
    and AP Invoice Distribution"."Spend YTD", Core."Date"."Year", 1) USING Core."Dim - Date"."Date" = CAST ( TRIM(BOTH ' ' FROM CAST ( EXTRACT( DAY FROM CURRENT_DATE )
    AS CHARACTER ( 30 ))) || '/' || TRIM(BOTH ' ' FROM CAST ( EXTRACT( MONTH FROM CURRENT_DATE ) AS CHARACTER ( 30 ))) || '/' || TRIM(BOTH ' ' FROM
    CAST (Core."Dim - Date"."Year" AS CHARACTER ( 30 ))) AS DATE )) ELSE 0 END
    Here I have taken this part of the code from above code and started testing from answers
    CAST ( TRIM(BOTH ' ' FROM CAST ( EXTRACT( DAY FROM CURRENT_DATE )
    AS CHARACTER ( 30 ))) || '/' || TRIM(BOTH ' ' FROM CAST ( EXTRACT( MONTH FROM CURRENT_DATE ) AS CHARACTER ( 30 ))) || '/' || TRIM(BOTH ' ' FROM
    CAST (Core."Dim - Date"."Year" AS CHARACTER ( 30 ))) AS DATE )) ELSE 0 END
    what I could make out is when I was casting it to date I was getting the error
    ORA-01830: date format picture ends before converting entire input string at OCI call OCIStmtExecute:
    So When I have casted it to char and removed the year function from concatenation it worked out.
    With the same idea I have used this part of the code in my main code above but here char was not working out, so I need to use date and there were no compilation
    errors as it used to be before.
    CASE WHEN Core."Dim - Date"."Year" = 'year(current_date)' THEN FILTER( AGO(Core."Fact - Spend and AP Invoice Distribution"."Spend YTD", Core."Date"."Year", 1)
    USING Core."Dim - Date"."Date" = VALUEOF(NQ_SESSION."R_Current_Date")) WHEN Core."Dim - Date"."Year" <> 'year(current_date)' THEN FILTER( AGO(Core."Fact - Spend
    and AP Invoice Distribution"."Spend YTD", Core."Date"."Year", 1) USING Core."Dim - Date"."Date" = CAST ( TRIM(BOTH ' ' FROM CAST ( EXTRACT( DAY FROM CURRENT_DATE )
    AS CHARACTER ( 30 ))) || '/' || TRIM(BOTH ' ' FROM CAST ( EXTRACT( MONTH FROM CURRENT_DATE ) AS CHARACTER ( 30 ))) || '/' || TRIM(BOTH ' '
    FROM CAST (Core."Dim - Date"."Year" AS CHARACTER ( 30 ))) AS DATE )) ELSE 0 END
    Now when I check results in reports. I get the error ORA-01830: date format picture ends before converting entire input string at OCI call OCIStmtExecute
    The problem here happening is
    Core."Dim - Date"."Date" data type is DATETIME
    and the concat string whole date type is DATE.
    Its like datetime=date
    Since becuase of this mismatch I assume I am getting this error.
    So I thought of changing the data type of Core."Dim - Date"."Date" data type in rpd. Even though I checked out to do the changes I am unable to do though I login with
    Admin account.
    Secondly I thought of changing the concat string whole date type to DATETIME then I get the syntax error.
    Any help on this would be much appreciated.
    Thanks.
    Edited by: 949675 on May 7, 2013 5:33 AM

  • Mapping activity step in BPM and related complex functions/conversions

    Hello Experts,
    a) I am trying to find out the complex conversions used in BPM process modelling activities such as mapping activity.
    What are the different complex conversions/functions which are very widely used/required in BPM projects?
    I am talking about custom functions and not the standard functions and rules provided by BPM mapping editor.
    b) How do we write a log function which can be used in mapping to log some attributes used in mapping to the java log.
    It is just additional logging feature on the top of standard BPM logs. But this additional log feature will be useful in reading logs for each step.
    c) I am getting only one document having 3 examples for EJB mapping function (concat, filter, and one good fair )-  can anyone provide any other functions and details around in this area?
    thx
    mike

    Hi Mike,
    Strongly suggest you close this discussion and create 3 new discussions - one for each separate question.  When you pile up multiple questions, often people aren't sure which one to answer, and the discussion stream tends to get very confused. 
    That's likely to be why no-one's responded in the last 5 days.
    Rgds,
    Jocelyn
    with my SCN Moderator hat on

  • Not able to use CONCAT in CDS View

    Hello,
    My requirement is to prepare a field by concatenating 'PR' in front of the field and use it in a CDS view.
    I am getting the below error while doing it.
    Is the issue with my HANA version or the code is wrong.

    Dear Abhishek,
    which Version of the ABAP stack do you have?
    The CDS function concat is only supported starting with Netweaver 740 SP08.
    Best Regards, Thomas

  • Using JPQL in a JDO Enviroment

    Hello,
    is there any way to use JPQL in a JDO enviroment. That means with a JDO PMF and PC-classes with JDO Metadata. The reason why I'm asking for, in our Enviroments it cost a lot of effort to migrate all the Metadata and Querys. The functionality of the JPQL language seems to me growing very fast and quickly, when I compare to JDO-QL. Our projects will have a great benefit if we could switch at runtime.
    regards
    Marcus

    Hello,
    thanks garcia for clearify my request. What you 've described is exactly what I'm interestes in.
    Just a word to the charater of Query languages. The more important question of using languages is solving the business problems. I'like the JDO language, but sometimes it is not enough especialy when deep functionality of set or relational operations is needed. So JPQL is a good      supplementation to JDOQL, in my opinion both are nessecary.
    I've done some research in the openjpa code, it should be possible to create a query from type "javax.persistence.JPQL" on a JDO persitancemanager, because the brokerimpl.class, which is the internal persistencemanger knows all the query languages.
    So Yun can you please forward these question to the developers?
    kind regrds
    Marcus Thierling
    Edited by Mthierling at 01/21/2007 4:11 AM

  • Concat in unbound item

    Hello,
    I need a concatenation of 2 names and I don't get it to work properly...
    As Unbound Type i have SQL Expression and for Derivation Expression there is L_FWR_ACHTERNAAM||' '||L_FWR_ROEPNAAM
    I also tried this with the function concat() itself but this result in the same problem. When I try to generate the module I have the error message:
    CDG-01061 ERROR: Unbound Item OIFF0420301.ILD.FWR_NAAM: Invalid derivation expression 'L_FWR_ACHTERNAAM||' '||L_FWR_ROEPNAAM' for this item's type
    Anyone who knows what to do?
    Sofie

    Hi Sofie,
    I think you can't do that on a lookup column usage, because these fields are filled using a post-query trigger (and using a SQL Expression it should be part of the main block query). Try using a 'client side function' or create a function in the database that will return the "fwr_naam" using the "fwr_id" and call that function in the SQL Expression - using only columns from the 'main' table usage.
    HTH
    Roel

  • Aggregate functions in EJBQL ???

    Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL?

    Does the latest version of Oracle App server support aggregate functions like SUM/COUNT/AVG in the EJBQL? Hi Swami --
    The latest version of Oracle9iAS - v903 is J2EE 1.3 compatible so it supports all of the EJB 2.0 specification.
    The EJB 2.0 specification lists the following functions for EJBQL:
    String Functions:
    CONCAT(String, String) returns a String
    SUBSTRING(String, start, length) returns a String
    LOCATE(String, String [, start]) returns an int
    LENGTH(String) returns an int
    Arithmetic Functions:
    ABS(number) returns a number (int, float, or double)
    SQRT(double) returns a double
    The latest version of the EJB 2.1 specification which will be part of J2EE 1.4, has added support for aggregate functions like orderby, sum, count, etc.
    11.2.7.2 Aggregate Functions in the SELECT Clause
    The result of an EJB QL query may be the result of an aggregate function applied to a path expression.
    The following aggregate functions can be used in the SELECT clause of an EJB QL query: AVG,
    COUNT, MAX, MIN, SUM.
    We will support these when the EJB 2.1 specification is finalized and we produce our J2EE 1.4 compatible implementation.
    cheers
    -steve-

  • EJB mapping function

    I am getting only one document having 3 examples for EJB mapping function (concat, filter, and one good fair )-  can anyone provide any other functions and details around in this area?
    thx
    mike

    Dear Mike,
    Please check if following documents are helpful.
    Effective Ways of Using Intermediate Timer with Human Task in BPM
    EJB Mapping Function for MDM Web Service in BPM
    How to get user language in BPM using custom EJB function - Netweaver Technology - SCN Wiki
    Search value in a list using EJB mapping function
    Thanks & Regards,
    Patralekha

  • Updated Filename in File Receiver

    I need to append today's date to the file name when outputting a file. The date isn't available in the outbound XML so I can't use variable substitution. Does anyone have any suggestions?

    Hi,
      I don't have access to a date or time in the outbound XML file so I can't use variable substitution. I can't add additional fields to the outbound message as the partner would reject them.
         To Map the Date function you no need any field in the source structure.The Date function is the standard function.and it wont take any input from sourece.it simply returns the current date in the specifies format.
    I see that I need to create a mapping to the root node, using my date and including a userdefined function to put this value somewhere I can get it later
    generally u specify your file name in Receiver communincation channel.So the same file name you have to concate with the Date (by usind predefined function Concat) and give the new string that means(ex:Filename = XYZ and Date :20080914 then new concated string whould be "XYZ20080914")
                you have to create one new UDF and copy the code that have specified and give the new String (for ex:XYZ20080914) as input.map it to root node.
              In ID you have to enable Adapter specific message attributes and also Filename in that.(Give * or any string in the place of File name) Because of this in the receiver file adapter it wont take the static filename which we have specified in the fiels FileName,instead it will take the File name which we have specified in Mapping UDF.

  • How to create a procedure in oracle to write the data into file

    Hi All,
    I am just wondered on how to create a procedure which will do following tasks:
    1. Concat the field names
    2. Union all the particular fields
    3. Convert the date field into IST
    4. Prepare the statement
    5. write the data into a file
    Basically what I am trying to achieve is to convert one mysql proc to oracle. MySQL Proc is as follows:
    DELIMITER $$
    USE `jioworld`$$
    DROP PROCEDURE IF EXISTS `usersReport`$$
    CREATE DEFINER=`root`@`%` PROCEDURE `usersReport`(IN pathFile VARCHAR(255),IN startDate TIMESTAMP,IN endDate TIMESTAMP )
    BEGIN
    SET @a= CONCAT("(SELECT 'User ID','Account ID','Gender','Birthdate','Account Registered On') UNION ALL (SELECT IFNULL(a.riluid,''),IFNULL(a.rilaccountid,''),IFNULL(a.gender,''),IFNULL(a.birthdate,''),IFNULL(CONVERT_TZ(a.creationDate,'+0:00','+5:30'),'') INTO OUTFILE '",pathFile,"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' FROM account_ a where a.creationDate>='",startDate,"' and a.creationdate <='",endDate,"')");
    PREPARE stmt FROM @a;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt ;
    END$$
    DELIMITER ;
    Regards,
    Vishal G

    1. Concat the field names
    Double Pipe (||) is the concatenation operator in Oracle. There is also a function CONCAT for this purpose
    2. Union all the particular fields
    Not sure what do you mean by UNION ALL particular fields? UNION ALL is a set operation applied on two different result sets that have the same projection.
    3. Convert the date field into IST
    SQL> select systimestamp "Default Time"
      2       , systimestamp at time zone 'Asia/Calcutta' "IST Time"
      3    from dual;
    Default Time                                       IST Time
    05-05-15 03:14:52.346099 AM -04:00                 05-05-15 12:44:52.346099 PM ASIA/CALCUTTA
    4. Prepare the statement
    What do you mean by prepare the statement?
    5. write the data into a file
    You can use the API UTL_FILE to write to a file.

  • File name for append processing mode with time stamp

    Hi Experts
    we are doing file to file scenario using the processing mode as Append.
    the requirement for us to append the files and we need to have new file name with time stamp added to the appended file.but in the processing mode of the file adapter either we can append or add time stamp. thatz the problem I am facing now.
    we are doing file based processing not message based ,micheal blog regarding the dynamic file name is for message based not for file based.
    Please provide your valuable comments.
    Thanks
    Faheem

    Hi mohamed,
                      I suggest you to map the target source structure to the required filename u want, like for example ur filename is input26062008.txt means to the target structure u perform the following mapping
    constant (input) concat with currentdate function --> concat with constant .txt --> map this concat to target. So u will get the filename u expected with the time.
    Then in the communication channel u select the mode as append. Now ur requirement will get solve i think so. plz try.
    Regards,
    Murugavel

  • Concatenate two columns

    Hi,
    In BI 11g, I am trying to concatenate DAY/DATE Columns.
    1."TM_Details"."Day" || "TM_Details"."Date"
    2.concat("TM_Details"."Day")+concat("TM_Details"."Date")
    But it displays some error, like
    Formula syntax is invalid.
    [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 22020] Function Concat does not support non-text types. (HY000)
    SQL Issued: SELECT "TM_Details"."Day" || "TM_Details"."Date" FROM "TMD"
    Thanks
    Kavitha

    Hi kavitha,
    1."TM_Details"."Day" || cast("TM_Details"."Date" as char)This works out perfectly as the syntax is right.But you need to cast it accordingly.
    2.concat("TM_Details"."Day")+concat("TM_Details"."Date")concat(cast("TM_Details"."Day as char),"cast(TM_Details"."Date" as char)) this is the right syntax.
    Before check what is the datatype of day column and Date column as it is erroring out as mismatch.Accordingly convert
    Use cast function to convert it to the format needed and here is the cast syntax cast(column as datatype)
    *UPDATED POST*
    Invalid Alias Format : Table_name.Column_name requiredDont type the table name and column name manually.Please select it from the subject area into the criteria and check if this table name and column name are correct and coming from the same table.
    hope answered.award points.
    Cheers,
    KK
    Edited by: Kranthi.K on May 24, 2011 11:50 PM

  • Changes to sapxmltoolkit.jar from PI7.0 to PI7.1

    Hi.
    This question is about "XSLT Mapping with Java Enhancement".
    We have build numerous interfaces that uses java functions in a XSL mapping.
    This works fine in PI7.0, but when porting to PI7.1 it stops to work.
    SAP gives examples how to make this work:
    PI7.0: http://help.sap.com/saphelp_nw70/helpdata/EN/55/7ef3003fc411d6b1f700508b5d5211/frameset.htm
    PI7.1: http://help.sap.com/saphelp_nwpi71/helpdata/en/83/2200cb50d345c793336d9a1683163e/frameset.htm
    The examples are identical, but again, it dosnt work on PI7.1.
    In PI7.1 the sapxmltoolkit.jar has been renamed to "sap.comtcsapxmltoolkit~sapxmltoolkit.jar". Trying to use the xsl process on standard XSLT transformations work fine.
    When trying the mentioned PI7.1 example, it throws an exception (TransformerConfigurationException), with the following Error Message: "ERROR:  'The first argument to the non-static Java function 'concat' is not a valid object reference."
    When trying with the PI7.0 sapxmltoolkit.jar, it works like a charm!
    Hope someone can help resolve this problem...
    Regards...
    Peter

    Hi Stefan.
    Thanks for a quick reply.
    It works now.
    Wonder how I missed that check button
    Regards...
    Peter

  • File to Mail scenario? File not received only namespace

    Hi,
    I tried to do file to mail scenario. I read blogs and forum questions before posting this.
    My problem is that I am sending.dat file in file to mail scenario.
    I used XIPAYLOAD and without Mail adapter
    When i received mail it contains attachement Untitled.xml and it does not contain my file data it contains only this.
      <?xml version="1.0" encoding="UTF-8" ?>
      <ns1:Mail xmlns:ns1="http://sap.com/xi/XI/Mail/30" />
    I do not know how to create file with payload containing To, from subject, content things. I tried Michal blog and disabled unneccessary fields etc. and when i send email as file but now In RWB it gives error
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: java.io.IOException: no sender address specified
    regards
    hussaan

    Hi again,
    Simple message types and i use ximail30_xsd.txt from sap note as external defination
    Message mapping is also simple according to SDN TV.
    Adapter: Mail
    Transport Protocol: SMTP
    Message Protocol:XIPayload
    Adapter Engine: Integration Server
    smtps://smtp.googlemail.com:465
    Authetication Method: Plain
    User: complete email address
    Mail Attributes:
    From: email address
    To: email address
    Subject: test
    Content encoding: base 64
    Keep attachement: Option Checked
    No other change i did, With this configuration i receive email with untitled.xml attachement which contains only namespace info (no data).
    In my other try i changed message mapping and uses to create payload which michal refers by using constants(text to describe TO, from, subject) and text functions(concat)  in message mapping fields.
    Integration driectory setting for that
    Adapter: Mail
    Transport Protocol: SMTP
    Message Protocol:XIPayload
    Adapter Engine: Integration Server
    smtps://smtp.googlemail.com:465
    Authetication Method: Plain
    User: complete email address
    Mail Attributes: option checked
    Content encoding: base 64
    Keep attachement: Option Checked
    With this option it gives error in RWB that no sender  found
    Regards
    hussaan

  • XPATH in receiver determination

    Hi,
    We need to dynamically determine the receiver service based on the payload.
    In the extended service editor we have succesfully used a simple XPATH expression to point out a specific field of the payload (just like using af context object) containing the service name.
    However, in most cases the service name is a substring of a field of the payload and furthermore a constant is to be added to give the full service name. We have tried to solve this problem using the XPATH functions 'concat', 'string' and 'substring'. But as soon as we add just the simplest function to the XPATH expression, the receiver determination fails (unable to process the XPATH).
    We have tested the XPATH with the actual message using XML Spy, and it works well.
    The XPATH expression is: "concat('SAPR3_', substring(string(/p1:receipt/p1:identity), 2, 5))"
    Any hints?
    Regards
    Lars

    Hi Lars,
    I just noticed, that you are talking about extended Service Editor - not a Condition - so my answer above is obviously rubbish.
    What remains true is that the XPath you use has to result in a node, than the nodes string is taken as a service.
    So I am afraid there is no easy solution for your problem...
    If you do not have too many receivers and this list is rather static, you could of course use conditions in the receiver determination - something like:
    receiver service = SAPR3_b if /.../ = abc
    but this is of course not really applicable if the list of possible receivers gets too long.
    Another possibility would be to use the substring as a receiver within the configuration. So take it from the payload in the receiver determination and use this 'service' for interface determination and receiver agreement.
    Than, within the receiver agreement you can exchange this name by the 'real' name in the header mapping (which is performed as the very last step in the pipeline). Since you have a receiver agreement per receiver anyway, you would not have to create additional configuration objects. The downfall is of course, that to 'read' the configuration (or the message monitoring) one has to know about this mapping trick...

Maybe you are looking for

  • How to design a Pricing Procedure with both MWST and MWSI in it ?

    Hi there. My business requirement dictates that I can have both Tax inclusive(PR01/MWSI) and Tax Exclusive(PR00/MWST) items within a Single Sales Order. I know that One pricing procedure can only be assigned to 1 Document Type. So, Has anyone success

  • JDBC Driver: Messages stuck in processing started at rwb

    Hi, I have ABAP Proxy (7.1 EHP1) -> JDBC (MS SQL Server) scenario. I'm trying to do INSERT_UPDATE.  The interfases works fine for the first 5 messages. If I check the DB I see rows inserted correctly, but the first five messages stucks in processing

  • GTC Page Error and Nexaweb Error

    hi all ! i am experiencing two problems. First one is that when i open GTC page on the Administrator and USer Console, i get this error message printed on top of the page +"Provider Registration Framework Initialization failure occurred: The underlyi

  • E-rec performance issues - Candidate Assignements tab is taking longer time

    Hello, We have some serious performance issues with candidate assignments in e-rec system. For the first time if you access a requisition with 60 candidates assigned, its taking more than 3 min to load. If you access again then its taking less than 3

  • Any function module available for...

    hi all, i need a function module to do a goods receipt for the PO using movement type 161, movement ind B, goodsmvt code '01'. i couldnt able to post using BAPI_GOODSMVT_CREATE as iam getting 'NO GOODS RECEIPT POSSIBLE FOR PO XXXXXXXX XXXXX'. So is t