JPQL unexpected token: CONCAT

Hello.
I am getting this error when passing the fallowing query:
SELECT webservice FROM Webservice webservice WHERE webservice.id IN
(SELECT tagws.id_ws FROM TagWs tagws WHERE  tagws.id_tag IN
     (SELECT tag.id FROM Tag tag WHERE  lower(tag.nume) like CONCAT('%', CONCAT(lower('vista'),'%'))  )
)I don't understand why, both concats take 2 arguments, so they are correct.What am I missing? I am using PostgreSQL 8.3, if it matters somehow.
Thanks!

JPQL does not allow functions with LIKE (not sure why).
You could log a bug with the spec, or your JPA provider, or use native SQL as a workaround. If you are using TopLink, you could also use an Expression query as a workaround, as this is only not supported in JPQL.
-- James : [http://www.eclipselink.org|http://www.eclipselink.org]

Similar Messages

  • TO_DATE function with JPA, Getting Unexpected Token error

    I am constructing a search query like this from my JAVA code
    SELECT * FROM EMAIL_PROXY_ERROR_LOG WHERE (to_date((REPLACE (DATETIME,'T',':')),'yyyy-mm-dd:hh24:mi:ss') BETWEEN to_date('2008-04-29:11:30:08','yyyy-mm-dd:hh24:mi:ss') AND to_date('2008-04-30:11:30:02','yyyy-mm-dd:hh24:mi:ss'))
    I am using Toplink Essentials and I get the following error while running, what would be a possible solution
    Exception Description: Syntax error parsing the query [select c FROM EmailProxyErrorLog c WHERE to_date((REPLACE (c.dateTime,'T',':')),'yyyy-mm-dd:hh24:mi:ss') BETWEEN to_date('2008-04-26:11:30:08','yyyy-mm-dd:hh24:mi:ss') AND to_date('2008-04-30:11:30:02','yyyy-mm-dd:hh24:mi:ss')], line 1, column 42: unexpected token [to_date].
    Internal Exception: line 1:42: unexpected token: to_date
    at oracle.toplink.essentials.exceptions.EJBQLException.unexpectedToken(EJBQLException.java:389)
    at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.handleANTLRException(EJBQLParser.java:350)
    at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.addError(EJBQLParser.java:278)
    at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.reportError(EJBQLParser.java:378)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.arithmeticPrimary(EJBQLParser.java:3617)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.arithmeticFactor(EJBQLParser.java:3513)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.arithmeticTerm(EJBQLParser.java:3407)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.simpleArithmeticExpression(EJBQLParser.java:1021)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.arithmeticExpression(EJBQLParser.java:2304)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.simpleConditionalExpression(EJBQLParser.java:2282)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionalPrimary(EJBQLParser.java:2218)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionalFactor(EJBQLParser.java:2155)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionalTerm(EJBQLParser.java:2030)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.conditionalExpression(EJBQLParser.java:1989)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.whereClause(EJBQLParser.java:507)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.selectStatement(EJBQLParser.java:184)
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.document(EJBQLParser.java:135)
    at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.parse(EJBQLParser.java:166)
    at oracle.toplink.essentials.internal.parsing.ejbql.EJBQLParser.buildParseTree(EJBQLParser.java:127)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:215)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:189)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:153)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:114)
    at oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.<init>(EJBQueryImpl.java:99)
    at oracle.toplink.essentials.internal.ejb.cmp3.EJBQueryImpl.<init>(EJBQueryImpl.java:86)
    at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerImpl.createQuery(EntityManagerImpl.java:204)
    Caused by: line 1:42: unexpected token: to_date
    at oracle.toplink.essentials.internal.parsing.ejbql.antlr273.EJBQLParser.arithmeticPrimary(EJBQLParser.java:3611)

    Hello,
    The JPQL dies not define a to_date function, which is why it will throw an exception when parsing the query string. You will need to use a native query for this if you need to convert database fields to dates for comparison.
    Best Regards,
    Chris

  • Java.sql.SQLException: Unexpected token: IN in statement

    I use Toplink 2.0-b41-beta2 (03/30/2007) and have a problem with the following JPQL query:
    “SELECT DISTINCT OBJECT(e) FROM Entry e WHERE e.location IN (SELECT loc From View v JOIN v.viewLocs vl JOIN vl.location loc where v.code = :code)”
    “Entry” is a subclass of “TrainElement”, location points to Entity Location. Entity View has a one-to-many relationship to ViewLoc whereas each ViewLoc has a relationship to a Location object.
    Toplink creates the following incorrect sql statement – I inserted some CRLF for better readability::
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b41-beta2 (03/30/2007))): oracle.toplink.essentials.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Unexpected token: IN in statement
    [SELECT DISTINCT t0.TELEM_TRAINELEM_ID, t0.TRAINELEMENT_TYPE, t0.TELEM_INDEX, t0.TTELEM_TRAIN_ID, t0.ENTRY_TYPE, t0.ENTRY_ARRIVAL, t0.DISPLAY, t0.ENTRY_ORDERED_STOP, t0.ENTRY_DEPARTURE, t0.ENTRY_ORDER_CODE, t0.ENTRY_PREV_SEC_ID, t0.ENTRY_NEXT_SEC_ID, t0.ENT_LOC_ID FROM TRAINELEMENT t0, LOCATION t1
    WHERE (( IN ((SELECT DISTINCT t2.LOC_ID, t2.LOC_GPSY, t2.LOC_GRX, t2.LOC_CODE, t2.LOC_GRY, t2.LOC_GPSX, t2.LOC_LOCAL_RADIO, t2.LOC_NAME, t2.DELETED, t2.LOC_CLASS_ID FROM VIEW t4, VIEWLOC t3, LOCATION t2 WHERE ((t4.VIEW_CODE = ?) AND ((t3.VIEWLOC_VIEW_ID = t4.VIEW_ID) AND (t2.LOC_ID = t3.VIEWLOC_LOCACTION_ID))))) AND (t0.TRAINELEMENT_TYPE = ?)) AND (t1.LOC_ID = t0.ENT_LOC_ID))]
    Error Code: -11
    Call: SELECT DISTINCT t0.TELEM_TRAINELEM_ID, t0.TRAINELEMENT_TYPE, t0.TELEM_INDEX, t0.TTELEM_TRAIN_ID, t0.ENTRY_TYPE, t0.ENTRY_ARRIVAL, t0.DISPLAY, t0.ENTRY_ORDERED_STOP, t0.ENTRY_DEPARTURE, t0.ENTRY_ORDER_CODE, t0.ENTRY_PREV_SEC_ID, t0.ENTRY_NEXT_SEC_ID, t0.ENT_LOC_ID FROM TRAINELEMENT t0, LOCATION t1 WHERE (( IN ((SELECT DISTINCT t2.LOC_ID, t2.LOC_GPSY, t2.LOC_GRX, t2.LOC_CODE, t2.LOC_GRY, t2.LOC_GPSX, t2.LOC_LOCAL_RADIO, t2.LOC_NAME, t2.DELETED, t2.LOC_CLASS_ID FROM VIEW t4, VIEWLOC t3, LOCATION t2 WHERE ((t4.VIEW_CODE = ?) AND ((t3.VIEWLOC_VIEW_ID = t4.VIEW_ID) AND (t2.LOC_ID = t3.VIEWLOC_LOCACTION_ID))))) AND (t0.TRAINELEMENT_TYPE = ?)) AND (t1.LOC_ID = t0.ENT_LOC_ID))
         bind => [ROMAN W-Pb, ENT]
    There sould be a “t0.ENT_LOC_ID” before the IN in the WHERE clause and the implicit join “ID FROM TRAINELEMENT t0, LOCATION t1” seems incorrect to me. At any rate the database (HSQLDB) rejects that incorrect sql statement.
    How can I circumvent that problem?
    A add the relevant mapping part of the involved classes.
    @Entity
    @DiscriminatorValue("ENT")
    public class Entry extends TrainElement implements IEntry {
         @ManyToOne(cascade = CascadeType.ALL)
         @JoinColumn(name = "ENT_LOC_ID", nullable = true)
         private Location location;
    @Entity
    @Table(name = "LOCATION")
    public class Location implements ILocation {
         // persistent part
         // primary key field
         @Id
         @GeneratedValue
         @Column(name = "LOC_ID")
         private Long id;
         @Column(name = "LOC_CODE", nullable = false)
         private String code;
         @Column(name = "LOC_NAME", nullable = false)
         private String name;
    @Entity
    @EntityListeners(EntityListener.class)
    @Table(name = "VIEW")
    public class View implements IView {
         // persistent
         // primary key field
         @Id
         @GeneratedValue
         @Column(name = "VIEW_ID")
         private Long id;
         @OneToMany(mappedBy = "view", cascade = CascadeType.ALL)
         private List<ViewLoc> viewLocs = new ArrayList<ViewLoc>();
    @Entity
    @Table(name = "VIEWLOC")
    @EntityListeners(EntityListener.class)
    public class ViewLoc implements IViewLoc {
         // persistent fields
         // primary key field
         @Id
         @GeneratedValue
         @Column(name = "VIEWLOC_ID")
         private Long id;
         @ManyToOne(cascade = CascadeType.ALL)
         @JoinColumn(name = "VIEWLOC_VIEW_ID", nullable = false)
         private View view;
         // direct Linking to the infrastrucutre location
         @ManyToOne(cascade = CascadeType.ALL)
         @JoinColumn(name = "VIEWLOC_LOCACTION_ID")
         private Location location;
    ….

    IN doesn't support objects, only state_field_path_expression that must have a string, numeric, or enum value.
    Try using
    “SELECT DISTINCT OBJECT(e) FROM Entry e WHERE e.location.id IN (SELECT loc.id From View v JOIN v.viewLocs vl JOIN vl.location loc where v.code = :code)”
    Best Regards,
    Chris

  • Ati driver install warning unexpected token `}'

    /var/lib/pacman/local/ati-drivers-8.22.5-4/install: line 32: syntax error near unexpected token `}'     do I need to worry about this

    it's not fixed at home :
    [root@ElroCorp nico]# pacman -S ati-drivers                             
    Targets: ati-drivers-8.22.5-4
    Total Package Size:   9.1 MB
    Proceed with upgrade? [Y/n]
    checking package integrity... done.
    loading package data... done.
    checking for file conflicts... done.
    /tmp/pacman-j2SHLE/.INSTALL: line 32: syntax error near unexpected token `}'
    /tmp/pacman-j2SHLE/.INSTALL: line 32: `}'
    installing ati-drivers... done.
    /var/lib/pacman/local/ati-drivers-8.22.5-4/install: line 32: syntax error near
    nexpected token `}'
    /var/lib/pacman/local/ati-drivers-8.22.5-4/install: line 32: `}'

  • BUG?: unexpected token in connection pane for cursor declaration

    If I declare a cursor with an order clause in the declaration part of a procedure in a package I will get the unexpected token. The code compiles without errors.
    SQL Developer 15.57.
    Windows XP SP2
    Oracle 10g
    example:
    declare procedure test( param in integer ) as
    cursor cur( nVal in integer ) is
    select * from tab where col1 = nVal
    order by col2;
    begin
    NULL;
    end test;
    If I comment out the order by line and proper end the line before all is OK in connection pane.

    There are a few issues logged for these unexpected tokens. We will be reviewing this section for 1.1.
    Regards
    Sue Harper

  • EJB QL "unexpected token: ( " Exception with IN operator and AND operator

    Hey everyone,
    Hopefully someone can help me. I am just starting to write more complex queries with EJB QL and am running into an issue. When I run my query I get an "Internal Exception: line 1:87: unexpected token: (" Exception below is my query with acording to the sun references I have managed to find looks right. Here is my query:
    SELECT OBJECT(e) FROM Period e, IN (e.myScorecardItem.cyclesList) t WHERE current_date() BETWEEN e.startDate AND e.endDate AND t.id =?1
    I have removed the portion with the IN navigation and it works fine, and I have removed the conditional statement and left the IN portion and that works fine but I can not get the to work together. Here is my bean relationships: Cycles have ScorecardItems have Periods. I am trying to find all the Periods that fall within a certain cycle. Any direction or help anyone can provide would be greatly appreciated.
    Thanks,
    Justen

    It's not inherently bad - but it does depend on the optimizer getting  good estimate of the data volume.
    Did you test with 200 distinct values in your IN list, and can you see in the execution plan Oracle estimate of how many rows the subquery would generate.
    Regards
    Jonathan Lewis

  • Bug in OC4J [unexpected token: IN] when use Subquery

    Hi
    I use this named query in my entity, but when I run it from JDeveloper 10.1.3.0.4 (SU2)
    it throw exception
    Thia is as sample query:
    @NamedQuery(name="EmpbyDept",query="SELECT object(o) FROM Employees o WHERE o.departments IN(SELECT object(d) FROM Departments d)")
    Internal Exception: Exception [TOPLINK-0] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.EJBQLException
    Exception Description: Syntax Recognition Problem parsing the EJBQL [SELECT object(o) FROM Employees o WHERE o.departments IN(SELECT object(d) FROM Departments d)]. The parser returned the following [unexpected token: IN]
    I looked in the Java Persistence API Proposed final for the In Expressions and it look like this:
    in_expression ::=state_field_path_expression [NOT] IN ( in_item {, in_item}* | subquery)
    in_item ::= literal | input_parameter
    Ghassan

    Hi Ghassan,
    At the moment we don't have a final date for the release, but we are hopeful to have a 10.1.3.1 Beta release very soon (in a few weeks), please keep watching the OTN space, and we will also announce it here in the forums.
    Thanks for your patience.
    Deepak

  • Package body in tree view shows "unexpected token"

    I have a package which is in production for months now. This does not show any error with PL/SQL Developer nor OraEdit. SQL Developer shows "unexpected token" after trying to expand the package into the list of functions and procedures. Database is 9.2, Sql developer is 1.0.0.14.22.
    Any idea how to fix this?
    Martin

    Did you get any test material? Here is one example.
    TABLES:
      CREATE TABLE "RAPTOR"."SETTLEMENTCALENDAR"
       (     "SSRRUNNUMBER" NUMBER(*,0) NOT NULL ENABLE,
         "SETTLEMENTDATE" DATE NOT NULL ENABLE,
         "SSRRUNTYPE" VARCHAR2(2 BYTE) NOT NULL ENABLE,
         "SSRRUNDATE" DATE NOT NULL ENABLE
      CREATE TABLE "RAPTOR"."DATAFILELOG"
       (     "DATAFILEID" NUMBER(*,0) NOT NULL ENABLE,
         "FILENAME" VARCHAR2(70 BYTE) NOT NULL ENABLE,
         "FILELASTMODIFIEDDATE" DATE NOT NULL ENABLE,
         "FILETYPE" VARCHAR2(8 BYTE),
         "FILEIDENTIFIER" VARCHAR2(50 BYTE),
         "FROMPARTICIPANTID" VARCHAR2(8 BYTE),
         "FROMPARTICIPANTROLECODE" VARCHAR2(2 BYTE),
         "TOPARTICIPANTID" VARCHAR2(8 BYTE),
         "TOPARTICIPANTROLECODE" VARCHAR2(2 BYTE),
         "CREATIONTIME" DATE,
         "PERIODENDDATE" DATE,
         "FILESTATUS" VARCHAR2(50 BYTE) NOT NULL ENABLE,
         "FILESTATUSDATETIME" DATE NOT NULL ENABLE,
         "EMAILINBOXLOGID" NUMBER(*,0),
         "RESPONSEFILE" VARCHAR2(50 BYTE),
         "RESPONSEFILEGROUPID" NUMBER(*,0),
         "DATETIMERECEIVED" DATE NOT NULL ENABLE
       CREATE TABLE "RAPTOR"."ELX_MULTI_PARAMETERS"
       (     "EMP_JOB_NAME" VARCHAR2(30 BYTE) NOT NULL ENABLE,
         "EMP_PARAM_NAME" VARCHAR2(30 BYTE) NOT NULL ENABLE,
         "EMP_STRING_VALUE" VARCHAR2(100 BYTE),
         "EMP_DATE_VALUE" DATE,
         "EMP_NUMBER_VALUE" NUMBER
       ) ;Code
    create or replace PACKAGE "ELX_PARMS_TOOLS" AS
    procedure do_settlementcal_gap_check(cutoff_date in date default null);
    END;
    create or replace PACKAGE BODY "ELX_PARMS_TOOLS" AS
    --This procedure checks the settlementcalendar table for gaps
    procedure do_settlementcal_gap_check( cutoff_date in date default null) is
    cursor gap_cursor is
      ((select rnum
       from ( select rownum rnum
              from datafilelog )
      where rownum <= ( select max(ssrrunnumber)
                          from settlementcalendar)
    minus
      select rnum
      from ( select rownum rnum
               from datafilelog )
      where rownum <= ( select max(ssrrunnumber)
                            from settlementcalendar
                         where settlementdate <=cutoff_date))
    minus
      select ssrrunnumber from settlementcalendar)
    minus
       select emp_number_value from elx_multi_parameters
            where emp_job_name ='SETTLECAL1'
            and   emp_param_name ='GAPEXCEPTION';
    begin
    null;
    end;
    END;

  • SQL Developer cloud login - Unexpected token NUMERIC_VALUE encountered

    Dear all
    I have set up a cloud database, the database is activated. I have reset the published sftp user which was sent by mail and a new user in APEX interface is created, the groups are attached.
    Now for cloud new connection in SQL Developer
    -> Username = my new created user
    -> URL= https://database-trialabsw.db.us1.oraclecloudapps.com/apex/
    -> SFTP-Username = provided by mail, password changed in Identity console
    -> SFTP-Hostname = sftp.us1.cloud.oracle.com
    When I want to connect, i am prompted with username set above, but if I enter the password which is set, a popup with this error message will be shown:
    Unexpected token NUMERIC_VALUE encountered
    I have create user as document in "Data Movement...." and i have seen the blog from Kris, but same error. Can you help me?
    Here is the error log from SQL Developer:
    Unexpected token NUMERIC_VALUE encountered at oracle.dbtools.raptor.cloud.auth.basic.BasicAuthenticationHandler.readProperty(BasicAuthenticationHandler.java:221)
    Edited by: user626582 on Oct 18, 2012 2:19 AM

    Hi,
    I download the latest version, but when I try to make the connection I always get an "Invalid resource owner credentials". I have given the user admin, user and develop role and can login with the user via the web interface.
    Is this path correct? https://database-trialabxn.db.us1.oraclecloudapps.com/apex/
    Is there anything else from a security setup I need to do?

  • Forms 10g compile : syntax error near unexpected token `in

    Hi,
    I am writing a code to compile FORMS 10g(10.1.2.0.2) in HP_UX one by one.
    this is the code---frm10g.sh
    *#!/bin/ksh*
    *# . ~oracle/forms/server/default.env*
    *# . sid icache*
    TERM=vt220
    *if [ $# != 2 ]*
    then
    echo Usage : $0 module_name module_type
    exit 1
    fi
    case $2 in
    FORM|form|F|f) ext1='fmb' ;ext='fmx' ; modtyp='FORM' ;;
    PLL|pll|p|lib|LIB) ext1='pll' ;ext='plx' ; modtyp='LIBRARY' ;;
    MENU|menu|M|m) ext1='mmb' ;ext='mmx' ; modtyp='MENU' ;;
    **) echo invalid parameter ; exit 1 ;*
    esac
    echo Generating $1.$ext
    frmcmp module=$1.$ext1 userid=abc/abc@abc output_file=../$1.$ext module_type=$modtyp batch=NO compile_all=special > ./log/$1.log
    when I try to excute above file frm10g.sh in command line i get following error. Please let me know how to fix it.
    [abc]u01/app/oracle/product/10.1.2/forms/forms/Forms10g:. frm10g.sh INV FORM
    : command not found
    : command not found
    'bash: ./frm10g.sh: line 13: syntax error near unexpected token `in
    'bash: ./frm10g.sh: line 13: `case $2 in
    I really aapreciate your help.
    Thanks
    Sandy

    Sandy,
    I must apologize. The Compile.sh does not come with the Oracle Dev Suite installation. However, the following is the contents of the compile.sh script we use. This script compiles a single form.
    #!/usr/bin/ksh
    ORACLE_HOME=/d01/oracle/ias1012;export ORACLE_HOME
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32:$ORACLE_HOME/ctx/lib:/usr/java1.2/jre/lib/sparc:$ORACLE_HOME/jdk/jre/lib/sparc:/usr/lib:/usr/dt/lib:/usr/openwin/lib:/usr/ucblib:usr/ccs/lib; export LD_LIBRARY_PATH
    MODULE_NAME=`echo $1|cut -d. -f1`
    MODULE_SUFFIX=`echo $1|cut -d. -f2`
    MODULE_MESG=${2:-"Compiling $1"}
    OK_MESG=${3:-"  Compiled sucessfully"}
    . .setpass_cir
    APP_PW='cir/'`eimauth -g cir`'@database'
    echo "************************************************************************* "
    echo ${MODULE_MESG}
    frmcmp.sh module=/d01/oracle/forms/${MODULE_NAME}.fmb userid=${APP_PW} compile_all=yes batch=yes
    RC=$?
    case "$RC" in
      0)
        echo ${OK_MESG}
        echo "Compile errors, return code: $RC "
        cat ${MODULE_NAME}.err
        echo "Compile errors in $1, press [enter] to continue.\c"
        read x
    esac
    eval exit $RCYou should be able to modify this to suit your needs.
    Craig...

  • PowerShell command returned an exception. Unexpected token 's' in expression or statement

    Hi All,
    I am trying to Creating a VM based on a Template in VMM through Orchestrator Runbook using below URL;
    http://blogs.catapultsystems.com/lrayl/archive/2013/07/03/orchestrator-system-center-integrations-part-3-creating-a-vm-based-on-a-template-in-vmm.aspx
    Runbook:
    But at the Create VM from Template activity runbook will failed:
    Throwing below error in while running runbook in Error Summary text:
    PowerShell command returned an exception. Unexpected token 's' in expression or statement.
    Exception: InvalidOperationException
    Target site: PSRunspaceInvoker.HandleInvokeException
    Stack trace:
       at Microsoft.SystemCenter.Orchestrator.Integration.PowerShellConnector.PSRunspaceInvoker.HandleInvokeException(Exception ex, ILogger logger)
       at Microsoft.SystemCenter.Orchestrator.Integration.PowerShellConnector.PSRunspaceInvoker.Invoke(RunspaceInvoke runspace, String script, ILogger logger)
       at Microsoft.SystemCenter.Orchestrator.Integration.PowerShellConnector.PSScriptRunner.Execute(String script)
       at Microsoft.SystemCenter.Orchestrator.Integration.VMM2012Domain.VM.CloneFromTemplate(String vmmServer, ParameterList inputParameters)
       at Microsoft.SystemCenter.Orchestrator.Integration.VMM2012QIK.VM.CloneFromTemplate.DoExecute(IActivityRequest request, ILogger logger)
       at Microsoft.SystemCenter.Orchestrator.Integration.VMM2012QIK.ActivityBase`2.Execute(IActivityRequest request, IActivityResponse response)
    Both Orchestrator & SCVMM powershell are set on Unrestricted powershell.
    Kindly suggest any solution or work around for resolution.
    Thanks Rahul$

    This may be a bit late and perhaps not even relevant but I came across this post when trying to solve an issue I had with a powershell script in Orchestrator. Maybe it will help you, or maybe it will help someone else.
    I was trying to create a connector between SCOM and our ticketing system. I wanted to export alert descriptions and in the process of testing I came across an alert description that had multiple lines and all kinds of crazy formatting. When I tried to assign
    the Published Data to a varialbe in my powershell script i would get an error "Unexpected token [a partial alert description] in expression or statement.". After looking at the actual alert description data and seeing that i was only getting some of it
    and not all of it it dawned on me that i somehow needed to escape out of all the crazy quoting, carriage returns, and special characters. to do that i assigned the Published Data to a variable in my powershell script as follows:
    $Description = @"
    {Description from "Get Alert"}
    Apparently the @" "@ is called a here-string. Somewhat interesting. Hope it helps you or someone else!

  • Unexpected token: {

    Trying to check how LV 2011/Mathscript supports clusters, I tried a Matlab script written by a colleague (function definition) and could not get it to pass the parsing stage in the Mathscript node.
    After correcting a few things that are not supported yet (such as the use a "~" for a dummy variable name, or anonymous function declaration), I ended up with a bizarre message:
     unexpected token: {
    The details show:
    Line 346, Column 4: unexpected token: {
    Line 346, column 4 is the end of the script, following a "end" declaration, which ends a sub-function declaration. There is no "{" character there.
    What gives?
    Solved!
    Go to Solution.

    Hi X.,
    There are a couple more issues in your script:
    1. When using multiple functions within a single m-file we currently don't support the use of "end" at the end of a function description. For example, this would be ok:
    function a = foo(x) 
     a=x;
    function b = bar(y) 
     if y>3 
      b=y;  
    wheras this would error:
    function a = foo(x) 
     a=x;
    end
    function b = bar(y) 
     if y>3 
      b=y; 
     end
    end
    2. If possible you may wish to refrain from using global variables since it causes the MathScript Node to run in decreased performance mode. For more info look here.
    3. You are still using varargin (which is not supported) in the Likelihood_subfunction parameters. You should treat this like you treated the original function call by replacing it with the total number of inputs you wish to use. In this case the four inputs required for the subfunction call.
    4. You are using optimset to pass options to fminsearch. Currently optimset is not supported. Our default values for max iterations and max function calls are 100 and 1000 respectively. If you really need to set these values to something different we may have some ideas. Please send me a pm if that is the case. 
    5. Finally, the syntax you use for fminsearch is not correct in MathScript. Our current implementation of fminsearch only supports two outputs. Having a third output (errflag) will cause this function to give an error.
    This script has been very useful to use in providing a usecase for support that we currently lack. Thanks for sharing and let us know if we can be of more help.
    Thanks,
    K Scott

  • Unexpected token on package body

    Tree shows a "Unexpected Token" message and icon for package bodies of some packages. After some investigation we discovered that it happens only when there is a "FOR UPDATE" clause in declared cursors in any of the packages functions. Without the clause the problem disapears. It compiles and runs correctly. Is there a fix for this bug?
    Thanks

    Here is a simple test case for the development team:
    CREATE OR REPLACE PACKAGE test_token IS
    PROCEDURE test_case;
    END;
    CREATE OR REPLACE PACKAGE BODY test_token IS
    PROCEDURE test_case
    IS
    test_var VARCHAR2(1);
    BEGIN
    SELECT TRIM('Z')
    INTO test_var
    FROM dual;
    EXCEPTION
    WHEN OTHERS THEN NULL;
    END test_case;
    END;
    Using:
    SQL Developer 1.0.0.14.67
    on Microsoft Windows XP Professional Version 2002 Service Pack2
    Oracle 10g Enterprise Edition Release 10.2.0.1
    on HP/UX Itanium 11.23

  • Unexpected Token '(' in expression or statement.

    I'm trying to retrieve DHCP server names and Leases using this script. But when I execute this section of the script of receive the following error message:
    Pwershell> C:\PowerShell\DHCPLease.ps1
    At C:\PowerShell\DHCPLease.ps1:287 char:25
    +  $line = $AllScopes[$i] (Read-Host " ").Split(",")
    +                         ~
    Unexpected token '(' in expression or statement.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken
    Here is the part of the script that is failing
    #region Get all Scopes in the Server
    # Run the Command in the Show Scopes var
    $AllScopes=Invoke-Expression$ShowScopes
    # Go over all the Results, start from index 5 and finish in last index -3
    for($i=5;$i-lt$AllScopes.Length-3;$i++)
    # Split the line and get the strings
    $line=$AllScopes[$i](Read-Host"
    ").Split(",")  
    -   This is the line I receive the error
    $Scope.Address
    +=Check-Empty$line[0]
    $Scope.Mask
    +=Check-Empty$line[1]
    $Scope.State
    +=Check-Empty$line[2]
    # Line 3 and 4 represent the Name and Comment of the Scope
    # If the name is empty, try taking the comment
    If(Check-Empty$line[3]-eq"-")
    $Scope.Name
    +=Check-Empty$line[4]
    else{
    $Scope.Name
    +=Check-Empty$line[3]}

    That "read-host" seems weird, that cmdlet is supposed to be used to read input from a user typing into the console. Try changing this line
    $line = $AllScopes[$i] (Read-Host" ").Split(",")
    to this
    $line = $AllScopes[$i].Split(",")
    DJ Grijalva | MCITP: EMA 2007/2010 SPA 2010 | www.persistentcerebro.com

  • Unexpected token in mapping

    Hello,
    I'm trying to extract data from Essbase to an Oracle database. The columns in the db map one on one with the dimensions in essbase but I am getting error on one dimension only. The error is:
    -11 : 37000 : java.sql.SQLException: Unexpected token: POSITION in statement [select            C2_ACCOUNT        ACCOUNT,      C10_PERIOD        PERIOD,      C12_ENTITY        ENTITY,      C9_VERSION        VERSION,      C13_EMPLOYEE_TYPE        EMPLOYEE_TYPE,      C1_POP        POP,      C11_FUNCTIONAL_TITLE        FUNCTIONAL_TITLE,      C5_EMPLOYEE        EMPLOYEE,      C7_CURRENCY        CURRENCY,      C6_POSITION        POSITION,      C8_GRADE        GRADE,      C4_SCENARIO        SCENARIO,      C3_YEARS        YEARS from      C$_0TEST1 where           (1=1)]
    I have checked the spellings of the dimension and the column and they are fine.
    Secondly, to extract data from Essbase does the ODI agent need to run on the Essbase server and does the reportscript have to be on the server as well? I have separate machines for ODI and Essbase and I have written a ReportScript and put it in a folder on the ODI machine.
    Thanks.

    That "read-host" seems weird, that cmdlet is supposed to be used to read input from a user typing into the console. Try changing this line
    $line = $AllScopes[$i] (Read-Host" ").Split(",")
    to this
    $line = $AllScopes[$i].Split(",")
    DJ Grijalva | MCITP: EMA 2007/2010 SPA 2010 | www.persistentcerebro.com

Maybe you are looking for