Switch: constant expression required

Hi,
i initialize some integer constants with the hash code of some strings. However, i cannot use these constants in "case"s of "switch". How can i deal with this?
Here's the code:
    public void parseHeader()
        char[] headerChars=header_.toCharArray(); //the array representation of the XML header tag
        StringBuffer sBuffer=new StringBuffer();  //the String
        char c=' ';
        int fieldCode=0;
        for (int i=0; i<headerChars.length; i++)
            c=(char)headerChars;
if (c=='\n')
switch(fieldCode)
case ACCEPT:
sAccept_=new String(sBuffer);
break;
case ACCEPT_CHARSET:
sAcceptCharset_=new String(sBuffer);
break;
case ACCEPT_ENCODING:
sAcceptEncoding_=new String(sBuffer);
break;
case ACCEPT_LANGUAGE:
sAcceptLanguage_=new String(sBuffer);
break;
case AUTHORIZATION:
sAuthorization_=new String(sBuffer);
break;
case CACHE_CONTROL:
sCacheControl_=new String(sBuffer);
break;
case CLIENT_IP:
sClientIp_=new String(sBuffer);
break;
case INT_CONNECTION:
sConnection_=new String(sBuffer);
break;
case CONTENT_LANGUAGE:
sContentLanguage_=new String(sBuffer);
break;
case CONTENT_LOCATION:
sContentLocation_=new String(sBuffer);
break;
case CONTENT_MD5:
sContentMD5_=new String(sBuffer);
break;
case WARNING:
sWarning_=new String(sBuffer);
break;
case X_FORWARDED_FOR:
sXForwardedFor_=new String(sBuffer);
break;
case X_SERIAL_NUMBER:
sXSerialNumber_=new String(sBuffer);
break;
default:
System.err.println("Header field with hash code: "+fieldCode+" detected");
else if (c==':')
fieldCode=new String(sBuffer).hashCode();
sBuffer=new StringBuffer();
else
sBuffer.append(c);
private static final int ACCEPT= "Accept".hashCode();
private static final int ACCEPT_CHARSET="Accept-Charset".hashCode();
private static final int ACCEPT_ENCODING="Accept-Encoding".hashCode();
private static final int ACCEPT_LANGUAGE="Accept-Language".hashCode();
private static final int AUTHORIZATION="Authorization".hashCode();
private static final int CACHE_CONTROL="Cache-Control".hashCode();
private static final int CLIENT_IP="Client-ip".hashCode();
private static final int CONNECTION="connection".hashCode();
private static final int CONTENT_LANGUAGE="Content-Language".hashCode();
private static final int CONTENT_LOCATION="Content-Location".hashCode();
private static final int CONTENT_MD5="Content-MD5".hashCode();
private static final int WARNING="Warning".hashCode();
private static final int X_FORWARDED_FOR="X-Forwarded-For".hashCode();
private static final int X_SERIAL_NUMBER="X-Serial-Number".hashCode();
Message was edited by:
uig

the labels in a switch-case statement have to be compile-time constant. Anything that involves calling a method is not.
you could make an enumerated type
http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html

Similar Messages

  • Error #: 409 : constant expression required at line 342

    hi all,
    switch( nodeClicked.hashCode() ) {
    case "Devices".hashCode(): showPanel_Devices();
    break;
    case "Clusters".hashCode(): showPanel_Clusters();
    break;
    case "General".hashCode(): showPanel_General();
    scan.nas.executeNTP(scan.getIPFromHash(parentNUSNode));
    scan.nas.executeSystemInfo(scan.getIPFromHash(parentNUSNode));
    scan.setValuesInNTP();
    scan.setValuesInSystemInfo();
    break; default: showPanel_LHNScreen();
    break;
    i am getting error at
    "Devices".hashCode()
    its saying that "constant expression required" at that place.......
    can anyone help me plz.....its urgent..............
    Thanks,
    Kalpana

    Case statements need integer literals or constant integer expressions. No runtime expressions are allowed.
    Do this instead:
    if(nodeClicked.equals("Devices")) ...;
    else if(nodeClicked.equals("Clusters")) ...;
    else if(nodeClikcked.equals("General")) ...;
    else ...;It's not a good idea to use hash codes like this, because two objects with different values can have the same hash code.

  • BUG: constant expression required

    Hello,
    the attached code fragment compiles with javac but produces a "constant expression required" with internal compiler (Version 10.1.3.0.4 (SU2))
    Regards
    Michael
    package bug.repro;
    public class Class1 {
    protected final int TYPE_LH = 1;
    package bug.repro;
    public class Class2 extends Class1 {
    protected void checkRule(int iStatus)
    switch (iStatus) {
    case TYPE_LH:
    break;
    -------

    Hi,
    thanks, i filed a bug.
    Frank

  • Constant expression required

    (Original thread http://forum.java.sun.com/thread.jsp?forum=31&thread=428634)
    Hello all,
    in the following class, if the comment is removed, the compiler complains that a constant expression is required.
    class Test {
    final static int A;
    final static int B=5;
    static {
    A=5;
    public static void main(String args[]) {
    switch(1) {
    //case A:
    case B:
    Is this a bug? Is this a feature? How could A not be a constant expression?
    Is it good coding style to initialize constant variables at declaration time and not in the static block?
    7Kami

    (Original thread
    http://forum.java.sun.com/thread.jsp?forum=31&thread=42
    634)
    Hello all,
    in the following class, if the comment is removed, the
    compiler complains that a constant expression is
    required.
    class Test {
    final static int A;
    final static int B=5;
    static {
    A=5;
    public static void main(String args[]) {
    switch(1) {
    //case A:
    case B:
    Is this a bug? Is this a feature? How could A not be a
    constant expression?JLS goes to a lot of detail explaining why this is a language feature. It is required to support Java's requirement to never have unreachable code. In order to do that, the compiler need to have compile-time const expressions in case labels (otherwise it can never detect at static compilation time whether a case branch is reachable or not [e.g., because it clashes with another case label]). Those expressions could be either literals or static finals etc.
    This, BTW, explains why inlining of static finals is not just an optimization but an essential language requirement.
    The relevant JLS sections to read are 14.20 and 13.4.8.

  • Error: An integer constant expression is required within the array subscrip

    hello all,
    here is a small piece of code which compile well with g++:
    #include <iostream>
    using namespace std;
    int main () {
    int i= 0, j=4 ;
    cout <<" i=" ; cin >> i ;
    cout  << "i="<<i<< endl;
    if ( i > 1) {
       double xx [i+5];
       int n= i+5;
       for (int k =0 ; k < n ; k++) xx[k] =k;
      cout << "xx[2]=" << xx[2] << " xx[4]=" << xx[4] <<" xx["<<i<<"]="<< xx[i] <<en
    dl;
      cout << "xx[1]=" << xx[3] << " xx[5]=" << xx[4] <<" xx["<<n-1<<"]="<< xx[n-1]
    <<endl;
    }with Sun Studio 12 CC, the error is:
    "x.C", line 12: Error: An integer constant expression is required within the array subscript operator.
    1 Error(s) detected.Is there an option to force CC to accept it? i read that CC has some gnu extensions (http://docs.sun.com/source/820-4155/c++.html)
    Thanks in advance for help,
    gerard

    This works:
    #include <iostream>
    #include <alloca.h>
    using namespace std;
    int main () {
    int i= 0, j=4 ;
    cout <<" i=" ; cin >> i ;
    cout  << "i="<<i<< endl;
    if ( i > 1) {
       double *xx = ( double * ) alloca( sizeof( *xx ) * ( i + 5 ) );
       int n= i+5;
       for (int k =0 ; k < n ; k++) xx[k] =k;
      cout << "xx[2]=" << xx[2] << " xx[4]=" << xx[4] <<" xx["<<i<<"]="<< xx[i] <<en
    dl;
      cout << "xx[1]=" << xx[3] << " xx[5]=" << xx[4] <<" xx["<<n-1<<"]="<< xx[n-1]
    <<endl;
    }

  • NI USB 6008: expected constant expression

    I am using NI USB 6008 device. Looking at NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage\Acq-Int Clk\
    So I want to modify the line that has
    DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,1000,&read,NULL));
    as
        DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,numsamps,TimeouT,DAQmx_Val_GroupByChannel,data,numsamps,&read,NULL));
    where the corresponding variables have been defined before like:
      Int_t xx=2;
      const Int_t numsamps = const_cast<Int_t&>(xx);
        int32       error=0;
        TaskHandle  taskHandle=0;
        int32       read;
        float64     data[numsamps];
        float64 RatE = float64(raTE);
        float64 TimeouT = float64(numsamps)/RatE;
    But when I try to compile I get this error message:
    $ nmake -f makefile.mak
    Microsoft (R) Program Maintenance Utility Version 8.00.50727.42
    Copyright (C) Microsoft Corporation.  All rights reserved.
            cl  -D_MT -D_DLL -MDd -EHsc  -nologo -G5 -GR -MD -DWIN32  -DVISUAL_CPLUS
    PLUS -D_WINDOWS -IC:\ROOT/include -O2 -c SNatInDAQ.cpp
    cl : Command line warning D9025 : overriding '/MDd' with '/MD'
    cl : Command line warning D9002 : ignoring unknown option '-G5'
    SNatInDAQ.cpp
    SNatInDAQ.cpp(261) : error C2057: expected constant expression
    SNatInDAQ.cpp(261) : error C2466: cannot allocate an array of constant size 0
    SNatInDAQ.cpp(261) : error C2133: 'data' : unknown size
    NMAKE : fatal error U1077: '"c:\Program Files\Microsoft Visual Studio 8\VC\BIN\c
    l.EXE"' : return code '0x2'
    Stop.
    What does it mean 'expected constant expression'? How can I get around this?
    What I want to do is pass the size of that data array from another function.

    Hi novaiscool,
    I think the issue is that you are declaring numsamps as a constant and the DAQmxReadAnalogF64 function wnats a non constant parameter.  Have you tried calling the function with a regular int or a value?  Give that a try and see if you get the same error. 
    You will also need to initialize numsamps to something since you are allocating an array using that variable. 
    Give those things a try and let me know how it works.
    Thank You,
    Nick F.
    Applications Engineer

  • ORA-56901: non-constant expression is not allowed for pivot|unpivot values

    Getting following errors
    ORA-56901: non-constant expression is not allowed for pivot|unpivot values
    ORA-06512: at "APPS.PIVOT_AWARD", line 16
    ORA-06512: at line 5
    when i run the following function it is giving error as above.
    can you please help me
    create or replace
    Function Pivot_award return sys_refcursor
    IS
       v_dept    VARCHAR2 (20000);
       v_query   VARCHAR2 (1000);
       op_rs sys_refcursor;
    BEGIN
      SELECT LISTAGG(award_number,',') WITHIN GROUP (ORDER BY award_id)
      INTO V_DEPT FROM xxdl.XXDL_CD_SCHEDULE_K_GTT ;
       v_query :=
          'SELECT *
            FROM (
            select award_name, award_id,award_number from xxdl.XXDL_CD_SCHEDULE_K_GTT)
            PIVOT(max(VAL) for award_number in  ('||v_dept||'))';
       OPEN op_rs FOR v_query;
       return op_rs;
    END;
    SELECT LISTAGG(award_number,',') WITHIN GROUP (ORDER BY award_id)
      INTO V_DEPT FROM xxdl.XXDL_CD_SCHEDULE_K_GTT ;
    Result of 1st query is PPE_T_CAPITAL,XIBNG,XIABP,XIABQ,XIABR,XIABS,XIABT,XIABU,XIABV,XIABW,XIAAE,XIAAF,XIAAG,XIAAH,XIAAI,XIAAJ,XIAAK,XIAAL,XIAAM,XIAAN,XIAAO,XIAAP,XIAAQ,XIAAR,XIAAS,XIAAU,XIAAU,XIAAV,XIAAZ,XIABD,XIABE,XIABF,XIABG,XIABH,XIABI,XIABJ,XIABK,XIABL,XIABM,XIABN,XIAAA,XIAAB,XIAAC,XIAAD,XIABY,XIABZ,XIACA,XIACB,XIACC,XIACD,XIACE,XIACF,XIACG,XIACH,XIACI,XIABA,XIAAW,XIAAX,XIAAY,XIACN,XIACT,XIACU,XIACP,AAAEX,XIACW,XIADC

    Hi Frank,
    Here is the create table and insert script. This is needed for me to show in report rows to columns.
    create table award_test(
      AWARD_NUMBER                            VARCHAR2 (15) ,                                                                                                                                                                                
    AWARD_NAME                              VARCHAR2(30)  ,                                                                                                                                                                               
    TOTAL_PROCEEDS                          NUMBER    ,                                                                                                                                                                                   
    EARNING_PROCS                           NUMBER    ,                                                                                                                                                                                   
    TOT_PROCS_EARNINGS                      NUMBER   ,                                                                                                                                                                                    
    GROSS_PROCS                             NUMBER   ,                                                                                                                                                                                    
    PROC_REF_DEF_ESCR                       NUMBER   ,                                                                                                                                                                                    
    OTH_UNSP_PROCS                          NUMBER  ,                                                                                                                                                                                     
    ISSUANCE_COST                           NUMBER   ,                                                                                                                                                                                    
    WORK_CAP_EXP                            NUMBER 
    --insert script
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAE','CEFA CP',300000000,200,300000200,300,500,600,0,700);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABG','CEFA K',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAS','Escondido Village #3',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('AAAEX','SU2009A',801806000,null,801806000,null,null,null,1806000,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABI','CEFA L-6',17815000,null,17815000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAP','CEFA R',115050508.15,null,115050508.15,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIACG','CEFA D',53150000,null,53150000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAB','Stu Union-1962',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAA','Notes Payable-Commercial Paper',350000000,null,350000000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABZ','CEFA L-3',9840000,null,9840000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAV','CEFA B',18106540,null,18106540,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAI','Medium Term Notes - Tranche 3',50000000,null,50000000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAZ','Recycling Pool',473379904.44,null,473379904.44,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAY','CEFA T2',187550000,null,187550000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAM','GMAC',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAU','CEFA A/K',16922982,null,16922982,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAC','SU TB 2002A - PARS',50000000,null,50000000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABL','CEFA L-9',15490000,null,15490000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABY','CEFA L-2',8775000,null,8775000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAJ','Frat 1&2',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAW','CEFA S',180727500,null,180727500,null,null,null,-472500,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAQ','Escondido Village #1',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIACW','CEFA U',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIACF','CEFA E',19753227.34,null,19753227.34,null,null,null,-106772.66,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIACN','CEFA T3',27562758.96,null,27562758.96,null,null,null,-47941.04,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAG','Medium Term Notes - Tranche 1',50000000,null,50000000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('PPE_T_CAPITAL','PPE_T_CAPITAL',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAK','Frat 3',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAF','Tresidder',0,null,0,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIABH','CEFA L',5055000,null,5055000,null,null,null,0,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAU','CEFA A/K',6605655,null,6605655,null,null,null,-74345,null);
    Insert into "award_test" (AWARD_NUMBER,AWARD_NAME,TOTAL_PROCEEDS,EARNING_PROCS,TOT_PROCS_EARNINGS,GROSS_PROCS,PROC_REF_DEF_ESCR,OTH_UNSP_PROCS,ISSUANCE_COST,WORK_CAP_EXP) values ('XIAAD','SU 2024 Bonds',150000000,null,150000000,null,null,null,0,null);Expected output rows to columns (i took first two insert statements)
    'XIAAE','CEFA CP',300000000,200,300000200,300,500,600,0,700
    'XIABG','CEFA K',0,null,0,null,null,null,0,null
    I need to have awardnumber and corresponding details below
    'XIAAE'       'XIABG'
    'CEFA CP'    'CEFA K'
    300000000   0
    200             null
    300000200   0
    This way i need to get all the information vertically with awardnumber. I have written following code but it is not working.
    create or replace
    Function Pivot_award return sys_refcursor
    IS
       v_dept    VARCHAR2 (20000);
       v_query   VARCHAR2 (1000);
       op_rs sys_refcursor;
    BEGIN
      SELECT LISTAGG('''' || award_number || '''',',') WITHIN GROUP (ORDER BY award_number)
      INTO V_DEPT FROM award_test ;
       v_query :=
          'SELECT *  from award_test
            UNPIVOT(VAL for operator in(                                                                                                                                                                                                       
    AWARD_NAME,                                                                                                                                                                                                              
    TOTAL_PROCEEDS,                                                                                                                                                                                                             
    EARNING_PROCS ,                                                                                                                                                                                                              
    TOT_PROCS_EARNINGS ,                                                                                                                                                                                                           
    GROSS_PROCS    ,                                                                                                                                                                                                               
    PROC_REF_DEF_ESCR ,                                                                                                                                                                                                        
    OTH_UNSP_PROCS ,                                                                                                                                                                                                              
    ISSUANCE_COST ,                                                                                                                                                                                                            
    WORK_CAP_EXP ))
            PIVOT(max(VAL) for award_number in  ('||v_dept||'))';
       OPEN op_rs FOR v_query;
       return op_rs;
    END;throwing an error ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    ORA-06512: at "APPS.PIVOT_AWARD", line 11
    ORA-06512: at line 5
    also when i run simple query
    SELECT *  from award_test
            UNPIVOT(VAL for operator in(                                                                                                                                                                                                       
    AWARD_NAME,                                                                                                                                                                                                              
    TOTAL_PROCEEDS,                                                                                                                                                                                                             
    EARNING_PROCS ,                                                                                                                                                                                                              
    TOT_PROCS_EARNINGS ,                                                                                                                                                                                                           
    GROSS_PROCS    ,                                                                                                                                                                                                               
    PROC_REF_DEF_ESCR ,                                                                                                                                                                                                        
    OTH_UNSP_PROCS ,                                                                                                                                                                                                              
    ISSUANCE_COST ,                                                                                                                                                                                                            
    WORK_CAP_EXP ))
            PIVOT(max(VAL) for award_number in  ('PPE_T_CAPITAL','XIBNG','XIABP')) Throwing an error
    ora-01790 Expression must have same datatype as correspoding expression
    Edited by: 893185 on Nov 10, 2011 2:00 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Using constant expression in query

    When I write a query, if I use a bind variable that could be null as for example:
    select *
    from table
    where :variable is null or column = :variable
    the performance drops significantly.
    I can't find any reason, so if you can help me...
    I also tried something simpler, and something I thought it shoud be faster.
    select *
    from table
    where 1=1 or column = :variable
    this query should return all the table, since 1=1 is allways true. It should be easier to evaluate, since it's the same as before, but it does not need to bind the variable. It takes five times longer than before.
    What I am looking for is to understand what the database does when I run this queries.
    Thankyou very much
    Edited by: user4823534 on 27-abr-2010 9:16

    I think I didn't explain myself.
    I have several very complex querys that use bind variables as optional parameters.
    What I noticed is that it's much slower (100 times maybe) to have a constant expression which is true in an or than evaluating something else. For example
    select * from table where :a is null or column1 in (select column1 from table2 where a = :a) should be faster than
    select * from table where column1 in (select column1 from table2 where a = :a) since the last one has to evaluate the in clause, and the first one is allways true.
    Thankyou for your patience and sorry for my bad english.

  • What all switches do we require for ccnp

                       I am doing training for Ccnp best institute in Delhi , networers zone (http://networkerszone.com/), suggest me what all series switches access is required for ccnp, apart from Cisco 6500, cisco nexus, cisco 3770 and 2960.

    Hi Naval,
    The best place to ask your question would be at the Cisco Learning Network Community: https://learningnetwork.cisco.com/index.jspa
    Regards,
    Cindy Toy
    Cisco Small Business Community Manager
    for Cisco Small Business Products
    www.cisco.com/go/smallbizsupport
    twitter: CiscoSBsupport

  • AP1200 and Switch Cisco Express 500

    Hi,
    We have an AP1200 (port 1) attached to a switch cisco express 500,in this switch we are using a Vlan and we have a DHCP server.
    The problem is when a new PC tries to connect to this AP, it takes to much time to assign the IP address, and in other cases the PC is disconnected from the System constantly. Do you know wich could be the problem ?

    It sounds like it could be a problem with your wireless signal - have your tried doing a carrier busy test on the AP to check for interference?
    Regardsd
    Aaron
    Please rate helpful posts.

  • Does an Airport Express require a wired connection to boost a Wi-Fi signal if I already have a wired Airport Time Capsule on the Network?

    I want to boost the Wi-Fi signal around my house. I have a 3TB Airport Time Capsule connected to my Virgin Media modem via a WLAN connection but wonder if an Airport Express device can be used at a remote location purely wirelessly - apart from a power connection obviously?

    Does AirPort Express require a wired connection.......if I already have a wired AirPort Time Capsule on the Network?
    No, but you will have much better network performance if you do wire the AirPort Express.
    The reason for this is that when you try to extend a network using wireless, you will typically lose about a half of the potential speed capability on the network.
    There is no network speed loss when you wire the Express.
    Here is what Apple's support document says about this:
    In the case of a wirelessly extended network, throughput may be reduced to less than 60 percent of that of a single device. The general rule is to keep the Wi-Fi network as simple as possible. You can accomplish this by using the minimum number of Wi-Fi base stations required to service the physical network area and by using Ethernet wherever possible.
    Extending the range of your Wi-Fi network by connecting Wi-Fi base stations together using Ethernet is always the best option, and will provide the best throughput

  • Switching from express 7.2.1 to pro 7.2.1

    I recently did the switch from express to pro (both 7.2.1 mac osx 10.4.6) and am impressed by the upgrade. Most of the songs I created in express are loading up in pro, except one. The one that doesn't work loads, but always crashes when I try to save it, even if I save it as a new project or use the save a copy as command. The big difference between the song that doesn't work and the ones that do is that the one that doesn't is significantly larger than the others. It's got a ton of audio files, automation, and is fairly long.
    Has anyone run into problems loading or saving express songs in pro?
    Any advice on how to save this session so I can move on in Logic pro?

    remove things you don't need, (see the audio window first, select unused, delete ), then save as project copying all files, inst....
    You can also try it with the audio engine off. Beyond that, I think they are the same file, but express doesn't allow you to open, edit, write certain things
    J

  • What's the password to logon the 3560 series switch on express setup

    what's the password to logon the 3560 series switch on express setup

    Hi Samuel,
    The 3560 doesn't have a password configured on it by default. You may want to double check the procedure for accessing Express Setup in case a step was missed:
    http://www.cisco.com/en/US/partner/docs/switches/lan/catalyst3560/hardware/quick/guide/3560gsg_08.html#wp49930
    If that still doesn't work, you can reset the switch to factory defaults by following this guide:
    http://www.cisco.com/en/US/partner/docs/switches/lan/catalyst3560/hardware/quick/guide/3560gsg_08.html#wp46478
    Hope that helps.
    -Mike

  • Does AirPort Express require better Internet than Ethernet?

    Wondering since I was having intermittent problems w my Linksys router &amp; trouble updating it so thought switching to Airport Express would give me a simple way to get things working.
    Very disappointed that noes it's worse than before. Yesterday after a # of tries I did get it partly set up &amp; although amber blinking lights, I was able to use Internet.
    Called Set up AppleCare call online to resolve amber light issue. She had me reset modem &amp; when we were done, I again had green light on Airport BUT NO INTERNET CONNECTION. She said to call my ISP cox.
    I did try after a reset to connect MacbookPro directly to Ethernet &amp; got it to connect. Then I unplugged Ethernet from Mac &amp; plugged into airport &amp; no connection again.
    So instead of Airport Express making things better, they are worse. I'm typing this on my iPhone 4S which for some reason has really slowed down.
    I learned that my old Motorola Surfboard modem is Docsis 2.0 &amp; cox is switching to 3.0.
    But it was working better, although frequent brief loss of connection.
    So does Airport require a better modem or better connection than just Ethernet or via my Linksys E1200?
    Not happy also that functionally worse off after calling AppleCare. I know she didn't cause the issue but her suggestion while standard tipped it over to not be connecting.
    &amp; typing all this on my iPhone is not fun although it did just now get back temporarily there for just a bit to its usual speed but now back to having to wait for it.

    Well I did the power down reset. But I think you missed the import of my question.
    I'm talking about an older modem that may be marginal. Not positive about the 2 Ethernet cables I have used either.
    So yes if the modem is working as it should I guess it should make a difference.
    But something is weird when I can can next via Ethernet &amp; then I just unplug the the rent from my Mac &amp; plug it into the wan port on the AirPort Express &amp; no connection.
    To look at the modem &amp; Airport across the room the lights make it look like they are fine.
    I just done have Internet connection to my Mac. I did yesterday w the amber lights flashing.
    &amp; I was connecting w the Linksys but had frequent loss of connection.
    So wondering if maybe Airport has slightly greater requirements that act as a tipping point so it connected without it but doesn't connect w it. But the green light supposedly shows its working fine.
    Well I did put out a wanted request on FreeOC for a compatible Docsis 3.0 cable modem. Supposedly they work better &amp; that might just make the difference.
    Don't really want to buy a new modem when I'm about to move to a new area where requirements might be different.

  • Need Help with 5 Port Switch, Airport Express, and wired iMac

    I recently purchased an airport express to accomodate my laptop's wireless capabilities. However, the airport express has only one ethernet port, as does my parents' modem. Thus, I could either hook up the airport or my parent's iMac. I chose the airport, which resulted in a few weeks worth of fights. To alleviate the problem, I purchased a linksys 5 port group switch, after someone told me I could use that to hook up both at the same time. Initially, the iMac wouldn't work. It registered what I was told was an invalid IP address. Then a cable technician came by, reset the modem (unplugged the battery), and now the airport does not work; it flashes yellow and says that it cannot detect the ethernet signal. 
    The iMac is running OSX 10.3 and the laptop OSX 10.4.  I am not sure if the modem can only accomodate one IP address or if there is any way to share IP addresses. Do I need to change something with the DHCP on my laptop? Do I need to manually enter an IP? Any help would be greatly appreciated. I'm completely lost....and without wireless internet.

    Instead of a switch you need a wireless router, because your modem will only assign one public ip address to the switch and that ip address will be forwarded to any one computer at a given time...You should replace the switch with a wireless router and it should resolve your concern...

Maybe you are looking for

  • Windows won't detect audio after installing windows 7.

    I have a hp pavilion dv9610us notebook pc with windows vista home premium  and i recently install windows 7. Now windows won't detect the audio device. I try different software but it said that it can't find the media or device.

  • I cannot load Lion for my macbook pro - it needs a core 2etc

    i cannot buy Lion for my macbook pro - it needs a core 2, Duo, Core i3, Corei5, Corei7, or Xeon processor!! now what! What do I need to do?

  • Is this page a threat?

    I frequent various casual games sites/blogs and today one of my bookmarked addresses caused the whole system to grind and moan. The url i have bookmarked is "http://www.funny-base.com/games/arcade.html". After five minutes of unresponsive activity, b

  • Web Dynpro Java Internationalization and backend ABAP function modules

    Friends, I have a requirement where I want my Web Dynpro Java application to support BRAZIL and CHINESE. I have been through the sample programs and tutorials and I understand how to support my application in these 2 languages. The challenge I am fac

  • Loadercli and delete command after table creation

    Hi all, I try under winows XP execute .bat file : echo off call "C:\Program Files\sdb\programs\bin\"Loadercli  -d TEST -n 192.168.168.1 -u user,pass -b test.txt pause test.txt contains: create table "table1" "FIELD_ID" fixed(10,0), "FIELD_2" varchar(