In Oracle 11g query, how can I refer to results of different column ....

I want to be able to refer to the results of C1 in another column expression C2. I get ORA-00904: "C1" invalid identifier, which makes sense. I know that I can repeat the entire very long CASE again in my C2 DECODE, but wondering if I can save the server many extra cycles from evaluating the CASE again.
SELECT [very long nested CASE statements] as C1, DECODE(C1,1,'YES','NO') as C2 FROM TABLE
Many thanks,
AK

Hello
You can't refer to the alias at the same level so you either have to repeat the CASE statement or wrap it in an inline view and refer to the alias in that. i.e.
SELECT
    c1,
    DECODE(C1,1,'YES','NO') as C2
FROM
        SELECT
            [very long nested CASE statements] as C1
        FROM
            FROM TABLE
    )HTH
David

Similar Messages

  • Spreadsheet: how can I store test results from different tests in the same central spreadsheet?

    I am looking to gather test data using LabVIEW. I then want to store all the data in the same spreadsheet, a kind of central data base. I know how to store single test data in a spreadsheet but I can I get the software to write new data in the same file without over writing the old data?

    My first recommendation is that if you need a database--use a database not a spreadsheet. A DBMS isn't that hard to use and could pay big dividends in the future.In any case, to answer your question directly, it sounds like you are writing tab-delimited data to a text file that you will then open with a spreadsheet program. On the file write vi is a boolean input that specifies whether the new data should be appended or overwrite the existing data (the default is to overwrite). Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How can I copy SQL results to different csv worksheets in the same workbook

    Hi all,
    I'm running a series of select statements using SQLPlus and I want the results for each statement to be copied to different worksheets within the same workbook.
    For example, this is what I want: 'select statement 1' is run and spooled to file.csv / worksheet1. When 'select statement 2' is run it is spooled to file.csv / worksheet2. Same csv file but a different worksheet.
    Right now my SQL is creating a seperate csv file for each select statement. Here's an example of my SQL:
    spool c:\TEMP22\App_Eng1.csv replace
    Select A.OBJECTOWNERID||','||B.OBJECTVALUE1
    from PSPROJECTITEM B, PSAEAPPLDEFN A
    Where B.PROJECTNAME = 'PRJETSC342'
    and B.SOURCESTATUS = 2
    and B.TARGETSTATUS = 1
    and B.OBJECTVALUE2 = ' '
    and B.OBJECTTYPE=33
    and A.AE_APPLID = B.OBJECTVALUE1;
    spool off
    Is what I want to accomplish possible? Any ideas? Thanks.

    As far as I know you can't have "worksheets" for .csv files. They are simply comma separated values (a flat file). I would suggest that you generate separate csv files for each of your queries and then create a new xls file and import each csv file as a new worksheet.
    If you want to automate this process, I recommend you read this:
    http://blogs.msdn.com/brian_jones/archive/2005/06/27/433152.aspx

  • How can I  refer an xml  Schema that was registred in Oracle xml DB

    How can I refer an xml Schema that was registred in Oracle xml DB, from other xml schema?
    I have the follow schema,:
    <?xml version="1.0" encoding="AL32UTF8"?>
    <xsd:schema targetNamespace="schemastipostasa.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb/XDBSchema.xsd"
    elementFormDefault="unqualified" version="1.0"
    attributeFormDefault="unqualified">
    <xsd:simpleType name="codigosType" xdb:SQLType="NUMBER(4)">
    <xsd:restriction base="xsd:positiveInteger" >
    <xsd:totalDigits value="4" />
    </xsd:restriction>
    </xsd:simpleType >
    <xsd:simpleType name="integerUnoType" xdb:SQLType="NUMBER(1)">
    <xsd:restriction base="xsd:int" >
    <xsd:totalDigits value="1" />
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="condicionType" xdb:SQLType="VARCHAR2(1)">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="S" >
    <xsd:annotation>
    <xsd:documentation>Condicion si es S</xsd:documentation>
    </xsd:annotation>
    </xsd:enumeration>
    <xsd:enumeration value="N" >
    <xsd:annotation>
    <xsd:documentation>Condicion no es N</xsd:documentation>
    </xsd:annotation>
    </xsd:enumeration>
    </xsd:restriction>
    </xsd:simpleType >
    </xsd:schema>
    I registred the schema written above with the folowwing pl*sql :
    DECLARE
    direc varchar2(2000);
    nombreArch BFILE;
    mens varchar2(2000);
    BEGIN
    direc:=uso_comun.pack_mail.fun_valor_param('TASA','DIR_DBSERVER');
    nombreArch:=bfilename(direc,'schemas_tipos_tasa.xsd');
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://xmlns.oracle.com/tasa/schemas.tipos.tasa.xsd',
    SCHEMADOC => nombreArch,
    LOCAL => TRUE,
    CSID => nls_charset_id('AL32UTF8'));
    dbms_lob.CLOSE(nombreArch);
    dbms_output.put_line('salio sin cancelar');
    exception
    when others then
    mens:=sqlerrm;
    dbms_lob.CLOSE(nombreArch);
    rollback;
    raise_application_error (-20001,'en registro shcema='||mens);
    END;
    Then, I want to register the following schema, that mention de schema above:
    <?xml version="1.0" encoding="AL32UTF8"?>
    <xsd:schema targetNamespace="schema.repuesto.xsd"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb/XDBSchema.xsd"
    xmlns:tns="http://xmlns.oracle.com/tasa/schemas.tipos.tasa.xsd"
    elementFormDefault="qualified" version="1.0"
    attributeFormDefault="unqualified" >
    <xsd:element name="PRECIORENG" type="preciorepType" />
    <xsd:complexType name="preciorepType" >
    <xsd:sequence minOccurs="1" maxOccurs="unbounded">
    <xsd:element name="CODIGO_MARCA" type="tns:codigosType" />
    <xsd:element name="ORIGEN_PRECIO" type="tns:integerUnoType" />
    <xsd:element name="INGRESO_POR_FALTANTE" type="tns:condicionType" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    But when a run the following script whith the same db-user:
    DECLARE
    direc varchar2(2000);
    nombreArch BFILE;
    mens varchar2(2000);
    BEGIN
    direc:=uso_comun.pack_mail.fun_valor_param('TASA','DIR_DBSERVER');
    -- nombreArch:=bfilename(direc,'prueba_schema_seis.xsd');
    nombreArch:=bfilename(direc,'Schema_repuesto_nuevo.xsd');
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL =>'http://xmlns.oracle.com/tasa/schema.repuesto.xsd',
    SCHEMADOC => nombreArch,
    LOCAL => TRUE,
    CSID => nls_charset_id('AL32UTF8'));
    dbms_lob.CLOSE(nombreArch);
    dbms_output.put_line('salio sin cancelar');
    --commit;
    exception
    when others then
    mens:=sqlerrm;
    dbms_lob.CLOSE(nombreArch);
    rollback;
    raise_application_error (-20001,'en registro shcema='||mens);
    END;
    tell me the error: ORA: 01031, insufficient privileges!!!!, what’s wrong??,

    Hi,
    To register schema, you require XDBADMIN system privilege granted to the user.
    Please verify this and retry.
    Rgds,
    Rakesh Tripathi

  • How can I refer to the PhotoShop Object library dynamically depend on the release of PhotoShop?

    Recently, I make a program, now I face a big program:
    I make the program by visual basic and photoshop script , but my client have different release of Photoshop, for example : photoshop 7.0 cs and cs2. I know every release of PhotoShop have ist own Object library, but in visual basic 6.0, I can only refer to one PhotoShop Object library. for example: if I refer to Photoshop 8.0 Object library, if my clients release of Photoshop is 7.0. there will be a error message : Run-time error '429 ( cant create object) Run-time error '430(Class does not support Automation or does not support expected interface), How can I refer to the PhotoShop Object library dynamically depend on the release of PhotoShop?
    my email is : [email protected] .
    any suggestion?

    Please read, and reply back here with information https://forums.adobe.com/thread/1499014
    -and try some steps such as changing browsers and turning off your firewall for downloads

  • How can i refer to the parent window of the window containing an applet ?

    Hi all,
    I m stuck up with something. I have a web page say 'page1' which has a link that opens up a popup window. This popup say 'page2' window has an applet. On clicking particular pins on the applet i need to
    direct page1 to another URL & close the popup window. i hv tried this code.
    URL url = new URL(applet.getCodeBase(), path);
    AppletContext appletcontext = applet.getAppletContext();
    appletcontext.showDocument(url, "content");
    JSObject win = JSObject.getWindow(applet);
    win.eval("alert(\"Do u wnat to close!\");");
    win.eval("window.close()");
    This code opens up another window on click of the pin, & shows an alert before closing the popup window. On using
    appletcontext.showDocument(url, "_parent"); or
    appletcontext.showDocument(url, "_top");
    The window containing applet gets refreshed with the URL but not page1.
    How can i refer so to page1 from the applet.

    You don't show your code for what parent or top are, but in an
    applet, you must stick with relative links. Once you have the
    appletcontext, use a relative path from there:
    In the snippet below, docName is a relative path, i.e. ../up/above
       * Displays the specified document in the Web browser.
       * @param docName String pathname of document to download from Webserver
       * @return void
      private void fetchDocument(String docName) {
         AppletContext ctx = getAppletContext();
         java.net.URL serverURL = getDocumentBase();
         java.net.URL codeURL   = getCodeBase();
         java.net.URL docURL = null;
         try {
            docURL = new java.net.URL(codeURL, docName);
         catch (java.net.MalformedURLException err) {
            System.out.println("unable to compute URL from (" + serverURL + ", " +
                               docName + ")");
         if(this.bDebug)
           System.out.println("Open document: " + docURL.toString());
         ctx.showDocument(docURL);
      }

  • Query: How can I combine several fields to one field

    I have this Query:
    SELECT T0.[Cardname], T1.[Street], T1.[ZipCode], T1.[City], T1.[Country] FROM OCRD T0  INNER JOIN CRD1 T1 ON T0.CardCode = T1.CardCode WHERE T0.[CardName] Like '%[%0]%'
    I have two questions on it:
    1)   Now I get two lines with the same results because each BusinessPartner has a billing-address and a shipment-address. How can I get one result with only the shipment-address fields.
    2)   When I run this query as a Formatted Search on an addressfield I only get the first field (= CardName) in the Addressfield. How can I get Cardname, Street, Zipcode, City and Country in ONE field (ic Address2)?

    Answer -1
    T1.AdresType = 'S' for ship to address
    T1.AdresType = 'B' for bill to address
    SELECT T0.Cardname, T1.Street, T1.ZipCode, T1.City, T1.Country FROM OCRD T0 INNER JOIN CRD1 T1 ON T0.CardCode = T1.CardCode WHERE T0.CardName Like '%%[%0]%' AND T1.AdresType = 'S'
    Answer-2
    Modify this query
    Select T1.Address + Char(12) + T1.ZipCode + Char(12) + T1.Street + Char(12) + T1.Block +Char(12) + T1.City + Char(12) + T1.County + Char(12) + T1.ZipCode
    FROM CRD1 T1 INNER JOIN OCRD T0 ON T0.CardCode = T1.CardCode
    Where T1.AdresType='S'
    Hope this solves problem.
    Edited by: Jeyakanthan A on May 28, 2009 1:45 PM

  • How can I export the results of a query?

    After executing a select statement I can see the results in a grid but how can I export the results (the data)?
    How can I export the results of a join of two or more tables?

    Right click in the results grid and select the Export menu option

  • How can i display the result of java class in InputText ?

    Hi all,
    How can i get the result of java class to InputText Or OutputText ???
    also can every one in the forum give me road map for dealing with java in oracle adf because i'm beginner in oracle adf
    i saw some samples in oracle adf corner but it's difficult for me.

    User,
    Always mention your JDev version, technologies used and clear usecase description (read through this announcement : https://forums.oracle.com/forums/ann.jspa?annID=56)
    How can i get the result of java class to InputText Or OutputText ???Can you elaborate on your requirement? Do you mean the return value of a method in a class as output text? Or an attribute in your class (bean?) as text field?
    -Arun

  • How can we modify the maximum no. of columns in pivot table ?

    hi all,
    How can we modify the maximum no. of columns in pivot table ?
    do i need to change the nqconfig.ini or instanceconfig file or else?
    thnx..

    A little search on the forum :
    In the instanceconfig.xml add a <PivotView> element under <ServerInstance> if one does
    not exist already.
    Within the <PivotView> element add an entry that looks like:
    <MaxCells>nnnnnn</MaxCells>
    where nnnnnn is your desired limit for the maximum total number of cells allowed
    in a pivot.
    Warning: an excessively large number will cause more memory consumption and
    slower browser performance.The details here :
    Oracle BI EE (10.1.3.2): Maximum total number of cells in Pivot Table excee

  • How can we restrict EQL result based on session value

    How can we restrict EQL result based on session value or by checking with EBS secured function?
    Example: I create a Item Search Dashboard but I have more than one inventory organizations and I want to restrict dashboard to bring inventory org respective data by validating responsibility/profile option.
    Can anyone help me on this or if my concept is wrong so can anyone please guide me?

    Hi Bob,
    Thank you. Sorry for the late reply but I was busy in other stuff. I did the jar file and copied that Jar file into .ear/APP-INF/lib and copied on server and updated the df.securitymanager property under framework settings on Endeca Studio and restarted Endeca Server and Studio but seems like my class didn't get read. Kindly suggest and find below snippet of code;
        public void applySecurity(PortletRequest request, MDEXState mdexState, Query query)
                throws MDEXSecurityException
      init(request);
      String remoteUser = request.getRemoteUser();
      String recordFilterExpression = "XX";
      if(recordFilterExpression != null) {
      DataSource ds;
      try {
      ds = new DataSource(request, mdexState.getId());
      try {
      ExpressionBase expression = ds.parseLQLExpression("FND_USER_NAME='" + remoteUser + "'");
      DataSourceFilter dataSourceFilter = new DataSourceFilter(expression); 
      } catch (Exception f) {
      throw new MDEXSecurityException("Unable to apply Expression", f);
      } catch (DataSourceException e) {
      throw new MDEXSecurityException("Unable to create DataSource", e);

  • How can I send email using two different email address that both link back to my one exchange account on my Ipad mini

    How can I send email using two different email address that both link back to my one exchange account on my Ipad mini? 
    On my PC I simply have a master return email address and use a POP for the secondary address.  Both are through the one exchange account without a problem.  I need to be able to do the same on my Ipad.

    Ah, I should have made that clear.  My domain didn't come from google.  It was purchased at and is hosted at dreamhost, but I haven't used their email servers in years - I just route everything through gmail.  I actually have a bunch of domains (with websites).
    Gmail has an option that lets someone with custom domains send (and receive) email through gmail using the custom domain once Google confirms proper ownership of the domain (to prevent spammers and such).  Gmail has a setting for "send email as" which allows gmail to be sent using a custom domain as the sender.  I'm pretty sure Apple's old mobileme had this feature too, but I didn't use it.

  • My husband and I share an iTunes account. We both just got iPads. How can we program them to have different phone numbers for FaceTime and messages

    My husband and I share an iTunes account. We both just got iPads. How can we program them to have different phone numbers for FaceTime and messages

    Use different email address (gmail?) just for FaceTime and Messages.
    Using FaceTime http://support.apple.com/kb/ht4319
    Troubleshooting FaceTime http://support.apple.com/kb/TS3367
    The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
    http://tinyurl.com/a7odey8
    Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/TS4268
    Using FaceTime and iMessage behind a firewall
    http://support.apple.com/kb/HT4245
    iOS: About Messages
    http://support.apple.com/kb/HT3529
    Set up iMessage
    http://www.apple.com/ca/ios/messages/
    Troubleshooting Messages
    http://support.apple.com/kb/TS2755
    Setting Up Multiple iOS Devices for iMessage and Facetime
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
    FaceTime and iMessage not accepting Apple ID password
    http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
    Unable to use FaceTime and iMessage with my apple ID
    https://discussions.apple.com/thread/4649373?tstart=90
    For non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
     Cheers, Tom

  • How can I get the value of "Warehose" column in a form

    How can I get the value of "Warehouse" column in the form below (I mean what table that contain this value):
    Production Supervisor >> Batches >> (Button) Material Details >> (Button) Line Allocations
    Well, for more clearly! My problem is I must have the Unit Cost of Items, so I've got it in the cm_cmpt_dtl (table), but if I want to, I must create a relation that require 2 filed, they're Item_ID and Whse_Code.
    There's no problem with Item_ID, but Whse_Code seem to be the Mission Impossible (hix, I hate that film!!!!)
    I wonder if It was right to post this topic here. But anyway I just post my question here, hope I could get some help.

    wow, many, many, many.... and many thanks!
    Just add a tiny modify to check out the Batch_type
    doc_id = (select batch_id from gme_batch_header where batch_no='&batch_number' and batch_type = 0)
    Because the batch_no can be duplicated as we also create Batch and Filrm Planned Order.
    Many thanks for your support!
    P/S: Sorry for my terrible English :P

  • How can I edit multiple clips with different frame rates on the same timeline

    how can I edit multiple clips with different frame rates on the same timeline

    You do not want to edit material from different frame rates on one timeline. You CAN do this, but it is a very bad idea - and this is why.
    Once you establish the sequence frame rate - lets say it is PAL material at 25fps, any material that you drop into the sequence other than 25 fps will have to be changed to play at 25 fps. If the material you add is NTSC (29.97), FCP will DROP 5 frames per sec to bring the frame rate down to 25 fps. Which 5 get thrown away? Every 6th one. This yields a funky cadence that becomes even more complex as as there are also interlaced fields (DV/NTSC is an interlaced format). Oh, and by the way, the image sizes are different as well. DV/PAL has 576 lines of resolution and DV/NTSC has 480. FCP has to scale up the NTSC to fit the PAL frame.
    You do not want FCP adjusting these things on the fly. You want to do a thoughtful (and time consuming) conversion so that you end up with all your material in one format with the best possible image from the conversion process. Compressor can do an adequate job with Frame Controls turned on. The Natress Standards Conversion FCP plugin is another way to go. A third option is to find a post house that can do the conversion for you using a hardware based process.
    The good news is, once everything is in the same format, editing it will be painless and the output process very quick.
    Whatever frame rate/ image size you select, I'd suggest using ProRes for the codec. It is 4:2:2 color and will withstand color correction and composting with much more grace than any variant of DV based codecs.
    Have fun.
    x

Maybe you are looking for

  • Problem with transacted JMS connection factory and transaction timeouts

              We encountered an interesting problem using transacted JMS connection factories.           An EJB starts a container managed transaction and tries to validate a credit card           before creating some information to a database for the us

  • Adobe App Manager - Photoshop CS6 Download Corrupt

    After clicking install, Photoshop CS6 will get to about 62% done, when it stops, says there is an error, that the file is corrupt, and that I should try again in a few minutes. Been trying all day with no different results. Is there a cache I need to

  • Links to browser don't work

    Url links in my wife's email program fail to pull up relevant pages in Firefox. Just sit there and do nothing. History. Started three or four months ago. Solution was to restart the computer. The links would then work for four or five clicks but stop

  • Is anyone having problems with iCloud not properly working on their MAC?

    it seems like iCloud works great between my iPhone 4S and my MACBOOK, particularly with Mail, they seem to sync perfectly however, the same does not happen with my iMac! With iCloud are all your systems suppose to sync the same? if so what should I b

  • Reg: VA01 sales order going to dump

    Dear all, In our develpment server(ecc 6.0),while creating sales order in VA01 for a sales area, when ever entering material number(variant configuration material)  and quantity and press enter, it is giving runtime error as i shown below. The follow