Oracle 10G - Dynamic Decode Function - s it possible - How for CR ?

I will rephrase my question with a better example, then aks my question:-
In the example below, we take the employee name (ename) and the department number (deptno) and display the salary of the employee by their department.
SELECT  * FROM 
(SELECT
  ename,
  sum(decode(deptno,10,sal)) DEPT10,
  sum(decode(deptno,20,sal)) DEPT20,
  sum(decode(deptno,30,sal)) DEPT30,
  sum(decode(deptno,40,sal)) DEPT40
  FROM emp
  GROUP BY ename)
  ORDER BY 1;
The expected result would be as sampled below:- 
ENAME          DEPT10     DEPT20     DEPT30     DEPT40
ADAMS                       1100
ALLEN                                  1600
BLAKE                                  2850
CLARK            2450
..........etc
I would wish to make the Select a dynamic one, with resepect to the departments i.e. I envisage a situation where the Departments increase for example, or are merged for that matter, in which case now my Decode will no longer be accurate. Can I do a Select that has dynamic columns for the departments??

How 'bout using this to feed a cross tab (MS SQL):
select ename, deptno, sum(sal) as salary
from emp
group by ename, deptno
Use ename for your rows, deptno as your columns, and summarize salary for the body of the cross tab.
HTH,
Carl

Similar Messages

  • Oracle 10g RAC installation on HP-UX 11.31 for SAP ERP 6.04

    Dear experts,
    We are trying to install SAP ERP 6.0 EHP4 with Oracle 10g RAC on HP-UX 11.31. Please note that, We are using VERITAS cluster filesystem (CFS) for this purpose and not HP-UX ServiceGuard ClusterFileSystem.
    *As per SAP procedure, we have installaed plain plain SAP system with single instance Oracle (ref: Configuration of SAP NetWeaver for Oracle Database 10gRAC guide). Now we are first trying to install Oracle Clusterware (CRS) and then we will install Oracle RAC software. Is this procedure right?*
    Which file (and its path) we have to use for CRS installation and its patch? Is it runInstaller under /oracle/stage/102_64/clusterware? With this file we can install CRS 10.2.0.1. Similarly for Oracle RAC, which files we are supposed to use, i.e for installation and patch upgrade?
    Also can we use clusterware package available from Oracle directly in the SAP environment?
    We tried to install CRS with runInstaller while running Configuration Assistant after root.sh script.
    The following commands are failing in Configuration Assistant:
    /oracle/CRS/102_64/bin/racgons add_config erpprdd1:4948 erpprdd2:4948
    /oracle/CRS/102_64/bin/oifcfg setif -global  lan1/20.20.20.0:cluster_interconnect lan0/192.168.3.0:public
    /oracle/CRS/102_64/bin/cluvfy stage -post crsinst -n erpprdd1,erpprdd2
    1st command does not give any output if run manually.
    2nd commands o/p: PRIF-12: failed to initialize cluster support services
    3rd commands fails in every check
    Please suggest the solution and expecting answers to the above mentioned questions.
    Thanks & Regards,
    Tejas

    >
    Charles Yu wrote:
    > Q1:  Oracle RAC with 9.2.x on HP-UX?
    > A:   For HA environment, cluster software is: MC/SG on HP-UX 11.31; there are  optional components of MC/SG  for supporting Oracle RAC and SAP application.  I was confused that I could not find the installation guide regarding 4.6C on MC/SG HA environment of HP-UX.
    > Charles
    Relevant docs for Service Guard (SG) cluster are available at http://docs.hp.com. Hope you have checked for the suport of oracle 92x on HP-UX 11.31
    >
    Charles Yu wrote:
    > Q2: Any reason why you don't use a supported database version?
    > A:   Actually, in order to avoiding the the risk of database upgrade and minimizing the migration risk,  top level has decided that keeping the same Oracle version. Indeed, we don't plan the migration of application. On the other hand, it is complicated to do the assessment for application migration.
    > Charles
    You can go for combined os migration and db release upgrade also at a stretch with the same downtime.

  • Unable to download Oracle 10g Release 2 (10.2.0.1.0) for Microsoft Windows

    Hello folks. When I tried twice today to download Oracle 10g from the URL shown at the bottom of this message, I got an error message: The page cannot be displayed.
    I STARTED the download process from the page, http://www.oracle.com/technology/software/products/database/oracle10g/index.html
    Thank you.
    COULD NOT DOWNLOAD FROM: http://download.oracle.com/otn/nt/oracle10g/10201/10201_database_win32.zip

    There were some problems downloading software that have since been fixed, retry your download.
    download.oracle.com broken

  • Oracle 10g Application Server 10.1.3.0 Installation for 64 bit

    Hi,
    Can anyone let me know if there is an Oracle 10g Application Server 10.1.3.0 download available for 64 bit windows 2003 Enterprise Edition installed on Intel X64 Xeon Processor (EMT64T).
    Rgds
    Satya

    Thanks jm.
    But when i tried to check from otn downloads there is a 64 bit deployment version available for itanium processors which we are not able to install on xeon processors. Anyways i installed the 32 bit version of 10G 10.1.3 on 64 bit and its working fine. Can you find out if there is any memory consuption for the 32 bit server when installed on 64 bit windows server
    thanks once again for your promt reply

  • Need Patch 10089559: ORACLE 10G 10.1.0.5 PATCH 40 BUG FOR WINDOWS 32

    Can't download the patch anymore. This is for the Infastrucrure database that Grid Control Uses 10.2.0.4.
    I already upgraded the database to 10.2.0.4 to a separate home
    But, Grid still thinks there is a database on the Grid Home, where the Database used to be in. I even tried deinstall the Database Portion from the OMS home but no dice. Oracle can't give me a workaround. So I always have to install patches to the OMS Home from 10.1.0.5 database, even though it hardly patches any files.
    Otherwise I see a home in the console using 10.1.0.5 needing this patch when I glance at the Grid EM Console.
    I tried editing the comps.xml file but it is too tricky.
    Thanks.

    Have you removed the related Targets from Grid Control?

  • PHP 5.2.4 with Oracle 10g.

    OS: Windows Vista
    PHP: 5.2.4
    Oracle: 10g (XE)
    Apache 2.2
    Hey all,
    hoping for a bit of help if possible! I'm unsure if this is the right place for this question. But here goes anyway!
    I installed PHP 5.2.4, Apache 2.2 and Oracle XE 10g today. I've set it up, and PHP is working fine on my server. However i'm having a bit of trouble with Oracle. I've pointed php.ini to the correct ext directory, and i've 'uncommented' the line "extension = php_oci8.dll".
    However when I go to connect to the database, I get the error "Call to undefined function: ora_logon()/ ocilogon()" I checked phpinfo, and the module has not been activated (which explains the error.)
    So I did a bit of research, and I read that I need uncomment the line ";extension = php_oracle.dll" in php.ini. However this line does not exist and nor did the 'php_oracle.dll' file.
    So I found the file in the binary .zip for PHP 5.2.4, put it in the 'ext' directory, and added the line to php.ini. But this did not help either.
    I'm at a bit of a loss how to do this?
    Any help would be much appreciated.
    Message was edited by:
    user600685

    The only thing I can see is this, which keeps repeating:
    [Thu Oct 18 12:34:55 2007] [notice] Apache/2.2.3 (Win32) PHP/5.2.4 configured -- resuming normal operations
    [Thu Oct 18 12:34:55 2007] [notice] Server built: Jul 27 2006 16:49:49
    [Thu Oct 18 12:34:55 2007] [notice] Parent: Created child process 880
    [Thu Oct 18 12:34:56 2007] [notice] Child 880: Child process is running
    [Thu Oct 18 12:34:56 2007] [notice] Child 880: Acquired the start mutex.
    [Thu Oct 18 12:34:56 2007] [notice] Child 880: Starting 250 worker threads.
    [Thu Oct 18 12:34:56 2007] [notice] Child 880: Starting thread to listen on port 80.

  • SYSTEM HANGS WHILE RUNNING EXP COMMAND IN ORACLE 10G

    WHEN WE ARE RUNNING THE EXP (EXPORT) COMMAND IN ORACLE 10G
    TO TAKE THE BACKUP IT GETS HANGED FOR A LONG TIME AND THEN IN THE LOG FILE WE FIND THE FOLLOWING ERROR MESSAGE.
    SOMETIMES AFTER RESTARTING THE SERVER WE ARE ABLE TO RUN THE EXP COMMAND.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    About to export specified users ...
    . exporting pre-schema procedural objects and actions
    . exporting foreign function library names for user MANHAR
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions for user MANHAR
    About to export MANHAR's objects ...
    . exporting database links
    . exporting sequence numbers
    . exporting cluster definitions
    *********************************** AT THIS POINT THE SYSTEM HANGS FOR A LONG TIME.
    EXP-00056: ORACLE error 24324 encountered
    ORA-24324: service handle not initialized
    EXP-00056: ORACLE error 24324 encountered
    ORA-24324: service handle not initialized
    EXP-00000: Export terminated unsuccessfully
    THE EXP COMMAND THAT WE USE IS AS FOLLOWS:
    EXP MANHAR/MANHAR FILE=F:\BACKUP\MANHAR.DMP LOG=F:\BACKUP\MANHAR.LOG BUFFER=1000000 GRANTS=Y CONSTRAINTS=Y
    WE ARE RUNNING THE EXP COMMAND ON THE SERVER ITSELF.
    THE SERVER OPERATING SYSTEM IS WINDOWS 2003 SERVER.
    Kindly give us a solution at the earliest.

    You should ask Oracle support for help. There's only one entry for this error stack (Bug 3361288 - Export of XMLSCHEMA may fail with ORA-24324 in UTF8), but it should have been fixed for your DB version and , as far as I can see, you don't have a Unicode database.
    Werner

  • Oracle Database 10g or Oracle 10g Express Edition

    Hi Friends,
    I have worked on Oracle 9i but now I would like to work on Oracle 10g but confuse because there are more option for download.Which one should I go for?
    Oracle Database 10g or Oracle 10g Express Edition ?
    Or Any other option.
    Any Suggestion are welcome.
    KarTiK.

    It all depends on what exactly you are planning to use oracle for. Depending on the version, there may be found or not some features, you can see it this way:
    EE > SE > XE
    EE is a superset of SE and SE is a superset of XE. So you will find several limitation on the XE edition.
    However, even though XE is a very limited version, it cannot be underestimated, it can be used for Spatial Data projects, it works with spatial data locator, and there are several guides that show how to use it with PHP so you can start a web site. WebPLSQL is included with it, so the only limit is your creativity.
    This version can be very useful, and you can make the most of it, you may be interested in reading this article Oracle Database 10g Express Edition: Not Just for Learners
    by Lewis Cunningham.
    The XE edition is free. So you can use it without license fees and is the best suitable tool for learning, it is easy to install and setup. You can have a fully functional XE database out of the box. Once you feel more comfortable with oracle technology you can start thinking about taking the next step to a SE or EE edition.
    ~ Madrid

  • Calling java from pl/sql in oracle 10g?its very urgent.

    Hi Friends,
    i hve simple java code:
    class Hell
    public static String Hello()
    return"hello world";
    & compile this code using javac & loaded Hell.class in to database using this command
    c:\>loadjava -user chandru/shekar@pulser c:\Hell.class
    & i wrote pl/sql like:
    CREATE OR REPLACE FUNCTION Hell RETURN String as language java name 'Hell.Hello() return java.lang.String';
    i will compile the code & run but at that time this error i am getting:
    ORA-29516: Aurora assertion failure: Assertion failure at eox.c:317
    Uncaught exception System error: java/lang/UnsupportedClassVersionError
    I am using oracle 10g.Plzzzzzzzzz help me.Its very important to for me.
    Is any path i hve to set for oracle 10g database.Plz any one help me.
    regards
    shekar

    Hello here is how I solved the problem
    Let us assume that i try to load the file Hello.Java into the user scott.
    public class Hello {
         public static String world() {
              return "hello world";
    1) Dropjava          
    You must drop the java class if you already have loaded the class onto the server.
    dropjava -u scott/tiger Hello.class
    2) load class on server and let the server compile the source code.
    It is necessary to compile the source code on the server when the server and the local machine have different Java versions. To check which Java version there is running on the client machine open a command prompt and write Java -version
    loadjava -user scott/tiger -resolve Hello.java
    3) Publish stored procedure      
    sqlplus scott/tiger@oracle
    CREATE OR REPLACE FUNCTION helloworld RETURN VARCHAR2 AS                LANGUAGE JAVA NAME 'Hello.world () return java.lang.String';
    4)Call stored procedure      
    VARIABLE myString VARCHAR2(20);
    CALL helloworld() INTO :myString;
    PRINT myString;
    RGDS
    Thomas Winterberg

  • Clearing alerts in Oracle 10g

    I have several alerts in the Oracle 10g Enterprise Manager which I have already catered for. Is there a way to clear these alerts??

    I looked thru the stored procs and I see a trigger for mgmt_current_severity and the mgmt$alert_current view shows you this data..
    Looks like mgmt_current_severity is the key to these alerts..
    I get the impression that 10g OEM was delivered missing quite a bit of the promised functionality .. like reporting and such.
    So I expect a big update soon.

  • Oracle Lite vs. Oracle 10g Express

    What is the difference between Oracle Lite and Oracle 10g Express Edition?
    Can an application written for oracle lite work out-of-the-box for the express edition?

    two completely different products. express is essentially the same as the server oracle database. same functionality, same sql and pl/sql support, same structure.
    olite is a different architecture in terms of data files, and the sql is slightly different, and does not support many new facilities. there is no pl/sql at all and performance/tuning is different.

  • Install oracle 10g on fedora 9

    Hi,
    I want to install oracle 10g on fedora 9. is it possible.
    If yes
    I download oracle 10g for linux from
    [form oracle.com|http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201linuxsoft.html]
    and when i run it on fedora 9 it give me error like
    Using paramFile: /10201_database_linux32/database/install/oraparam.ini
    Checking installer requirements...
    Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
                                          Failed <<<<
    Exiting Oracle Universal Installer, log for this session can be found at /tmp/OraInstall2009-02-17_03-34-41PM/installActions2009-02-17_03-34-41PM.logIf i need to download diff s/w please send me any link or it is not supported.
    Thanks

    Umesh,
    I don't think so it supported but you can download oracle for enterprise linux and try it out.
    http://edelivery.oracle.com/linux
    For platform certification see following link,
    http://www.oracle.com/technology/support/metalink/index.html
    Regards

  • How to Migrate DB2 database to Oracle 10g R2 with this Developer Workbench

    Hi
    Can anybody tell how to migrate all the data which is present in DB2 to Oracle 10g Release2 through this tool. will it be possible to migrate all the data(tables,stored procedures,views,etc)?.
    if anybody knows how to do it please provide me the entire steps for the same.
    I am in bad need of help to Migrate my database to Oracle 10g R2
    Thanks in expectation,
    Selva

    Selva,
    The link for plugins is: http://www.oracle.com/technology/software/tech/migration/workbench/index.html. You can find DB2 plugins at the bottom of the page.
    Regarding the migration procedure, you can start by reading this document:
    http://www.oracle.com/technology/tech/migration/workbench/htdocs/101040/user_guide/book.pdf
    Good luck,
    andrei

  • How to connect mysql and oracle 10g by UTL_HTTP?

    how to connect mysql 5.0 and oracle 10g r2 by UTL_HTTP?what to do for this url connection exactly?

    cant i change anything to stup a link?
    SQL> desc utl_http
    PROCEDURE ADD_COOKIES
    Argument Name               Type               In/Out Default?
    COOKIES               TABLE OF RECORD      IN
    FUNCTION BEGIN_REQUEST RETURNS RECORD
    Argument Name               Type               In/Out Default?
       URL                    VARCHAR2(32767)      OUT
       METHOD               VARCHAR2(64)          OUT
       HTTP_VERSION           VARCHAR2(64)          OUT
       PRIVATE_HNDL           BINARY_INTEGER          OUT
    URL                    VARCHAR2          IN
    METHOD                VARCHAR2          IN     DEFAULT
    HTTP_VERSION               VARCHAR2          IN     DEFAULT
    PROCEDURE CLEAR_COOKIES
    PROCEDURE CLOSE_PERSISTENT_CONN
    Argument Name               Type               In/Out Default?
    CONN                    RECORD               IN
       HOST                VARCHAR2(256)          IN
       PORT                BINARY_INTEGER          IN
       PROXY_HOST               VARCHAR2(256)          IN
       PROXY_PORT               BINARY_INTEGER          IN
       SSL                    BOOLEAN           IN
    PROCEDURE CLOSE_PERSISTENT_CONNS
    Argument Name               Type               In/Out Default?
    HOST                    VARCHAR2          IN     DEFAULT
    PORT                    BINARY_INTEGER          IN     DEFAULT
    PROXY_HOST               VARCHAR2          IN     DEFAULT
    PROXY_PORT               BINARY_INTEGER          IN     DEFAULT
    SSL                    BOOLEAN           IN     DEFAULT
    PROCEDURE END_REQUEST
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    PROCEDURE END_RESPONSE
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    PROCEDURE GET_AUTHENTICATION
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    SCHEME                VARCHAR2          OUT
    REALM                    VARCHAR2          OUT
    FOR_PROXY               BOOLEAN           IN     DEFAULT
    PROCEDURE GET_BODY_CHARSET
    Argument Name               Type               In/Out Default?
    CHARSET               VARCHAR2          OUT
    FUNCTION GET_BODY_CHARSET RETURNS VARCHAR2
    PROCEDURE GET_COOKIES
    Argument Name               Type               In/Out Default?
    COOKIES               TABLE OF RECORD      IN/OUT
    FUNCTION GET_COOKIE_COUNT RETURNS BINARY_INTEGER
    PROCEDURE GET_COOKIE_SUPPORT
    Argument Name               Type               In/Out Default?
    ENABLE                BOOLEAN           OUT
    MAX_COOKIES               BINARY_INTEGER          OUT
    MAX_COOKIES_PER_SITE          BINARY_INTEGER          OUT
    PROCEDURE GET_DETAILED_EXCP_SUPPORT
    Argument Name               Type               In/Out Default?
    ENABLE                BOOLEAN           OUT
    FUNCTION GET_DETAILED_SQLCODE RETURNS BINARY_INTEGER
    FUNCTION GET_DETAILED_SQLERRM RETURNS VARCHAR2
    PROCEDURE GET_FOLLOW_REDIRECT
    Argument Name               Type               In/Out Default?
    MAX_REDIRECTS               BINARY_INTEGER          OUT
    PROCEDURE GET_HEADER
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    N                    BINARY_INTEGER          IN
    NAME                    VARCHAR2          OUT
    VALUE                    VARCHAR2          OUT
    PROCEDURE GET_HEADER_BY_NAME
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    NAME                    VARCHAR2          IN
    VALUE                    VARCHAR2          OUT
    N                    BINARY_INTEGER          IN     DEFAULT
    FUNCTION GET_HEADER_COUNT RETURNS BINARY_INTEGER
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    PROCEDURE GET_PERSISTENT_CONNS
    Argument Name               Type               In/Out Default?
    CONNECTIONS               TABLE OF RECORD      IN/OUT
    FUNCTION GET_PERSISTENT_CONN_COUNT RETURNS BINARY_INTEGER
    PROCEDURE GET_PERSISTENT_CONN_SUPPORT
    Argument Name               Type               In/Out Default?
    ENABLE                BOOLEAN           OUT
    MAX_CONNS               BINARY_INTEGER          OUT
    PROCEDURE GET_PROXY
    Argument Name               Type               In/Out Default?
    PROXY                    VARCHAR2          OUT
    NO_PROXY_DOMAINS          VARCHAR2          OUT
    FUNCTION GET_RESPONSE RETURNS RECORD
    Argument Name               Type               In/Out Default?
       STATUS_CODE               BINARY_INTEGER          OUT
       REASON_PHRASE          VARCHAR2(256)          OUT
       HTTP_VERSION           VARCHAR2(64)          OUT
       PRIVATE_HNDL           BINARY_INTEGER          OUT
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    RETURN_INFO_RESPONSE          BOOLEAN           IN     DEFAULT
    PROCEDURE GET_RESPONSE_ERROR_CHECK
    Argument Name               Type               In/Out Default?
    ENABLE                BOOLEAN           OUT
    PROCEDURE GET_TRANSFER_TIMEOUT
    Argument Name               Type               In/Out Default?
    TIMEOUT               BINARY_INTEGER          OUT
    PROCEDURE READ_LINE
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    DATA                    VARCHAR2          OUT
    REMOVE_CRLF               BOOLEAN           IN     DEFAULT
    PROCEDURE READ_RAW
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    DATA                    RAW               OUT
    LEN                    BINARY_INTEGER          IN     DEFAULT
    PROCEDURE READ_TEXT
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    DATA                    VARCHAR2          OUT
    LEN                    BINARY_INTEGER          IN     DEFAULT
    FUNCTION REQUEST RETURNS VARCHAR2
    Argument Name               Type               In/Out Default?
    URL                    VARCHAR2          IN
    PROXY                    VARCHAR2          IN     DEFAULT
    WALLET_PATH               VARCHAR2          IN     DEFAULT
    WALLET_PASSWORD          VARCHAR2          IN     DEFAULT
    FUNCTION REQUEST_PIECES RETURNS TABLE OF VARCHAR2(2000)
    Argument Name               Type               In/Out Default?
    URL                    VARCHAR2          IN
    MAX_PIECES               BINARY_INTEGER          IN     DEFAULT
    PROXY                    VARCHAR2          IN     DEFAULT
    WALLET_PATH               VARCHAR2          IN     DEFAULT
    WALLET_PASSWORD          VARCHAR2          IN     DEFAULT
    PROCEDURE SET_AUTHENTICATION
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    USERNAME               VARCHAR2          IN
    PASSWORD               VARCHAR2          IN     DEFAULT
    SCHEME                VARCHAR2          IN     DEFAULT
    FOR_PROXY               BOOLEAN           IN     DEFAULT
    PROCEDURE SET_BODY_CHARSET
    Argument Name               Type               In/Out Default?
    CHARSET               VARCHAR2          IN     DEFAULT
    PROCEDURE SET_BODY_CHARSET
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    CHARSET               VARCHAR2          IN     DEFAULT
    PROCEDURE SET_BODY_CHARSET
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       STATUS_CODE               BINARY_INTEGER          IN/OUT
       REASON_PHRASE          VARCHAR2(256)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    CHARSET               VARCHAR2          IN     DEFAULT
    PROCEDURE SET_COOKIE_SUPPORT
    Argument Name               Type               In/Out Default?
    ENABLE                BOOLEAN           IN
    MAX_COOKIES               BINARY_INTEGER          IN     DEFAULT
    MAX_COOKIES_PER_SITE          BINARY_INTEGER          IN     DEFAULT
    PROCEDURE SET_COOKIE_SUPPORT
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    ENABLE                BOOLEAN           IN     DEFAULT
    PROCEDURE SET_DETAILED_EXCP_SUPPORT
    Argument Name               Type               In/Out Default?
    ENABLE                BOOLEAN           IN     DEFAULT
    PROCEDURE SET_FOLLOW_REDIRECT
    Argument Name               Type               In/Out Default?
    MAX_REDIRECTS               BINARY_INTEGER          IN     DEFAULT
    PROCEDURE SET_FOLLOW_REDIRECT
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    MAX_REDIRECTS               BINARY_INTEGER          IN     DEFAULT
    PROCEDURE SET_HEADER
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    NAME                    VARCHAR2          IN
    VALUE                    VARCHAR2          IN     DEFAULT
    PROCEDURE SET_PERSISTENT_CONN_SUPPORT
    Argument Name               Type               In/Out Default?
    ENABLE                BOOLEAN           IN
    MAX_CONNS               BINARY_INTEGER          IN     DEFAULT
    PROCEDURE SET_PERSISTENT_CONN_SUPPORT
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    ENABLE                BOOLEAN           IN     DEFAULT
    PROCEDURE SET_PROXY
    Argument Name               Type               In/Out Default?
    PROXY                    VARCHAR2          IN
    NO_PROXY_DOMAINS          VARCHAR2          IN     DEFAULT
    PROCEDURE SET_RESPONSE_ERROR_CHECK
    Argument Name               Type               In/Out Default?
    ENABLE                BOOLEAN           IN     DEFAULT
    PROCEDURE SET_TRANSFER_TIMEOUT
    Argument Name               Type               In/Out Default?
    TIMEOUT               BINARY_INTEGER          IN     DEFAULT
    PROCEDURE SET_TRANSFER_TIMEOUT
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    TIMEOUT               BINARY_INTEGER          IN     DEFAULT
    PROCEDURE SET_WALLET
    Argument Name               Type               In/Out Default?
    PATH                    VARCHAR2          IN
    PASSWORD               VARCHAR2          IN     DEFAULT
    PROCEDURE WRITE_LINE
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    DATA                    VARCHAR2          IN
    PROCEDURE WRITE_RAW
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    DATA                    RAW               IN
    PROCEDURE WRITE_TEXT
    Argument Name               Type               In/Out Default?
    R                    RECORD               IN/OUT
       URL                    VARCHAR2(32767)      IN/OUT
       METHOD               VARCHAR2(64)          IN/OUT
       HTTP_VERSION           VARCHAR2(64)          IN/OUT
       PRIVATE_HNDL           BINARY_INTEGER          IN/OUT
    DATA                    VARCHAR2          IN

  • SQL Expression in decode function or case statement?

    Can I put SQL expressions in decode function or case statement?
    For example,
    select le.profile, decode( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile, 0, 'N', 'Y')
    from element le;
    or
    select le.profile, case WHEN ( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile) = 0 THEN 'N'
    ELSE 'Y'
    from element le;
    None of the above work.
    Can anyone tell me how to make it work?
    Is there any workaround?
    Thanks,
    J

    You simply needed and END to your CASE statement;
    SQL> with profile_data as (
       select 'XXXX_AFTER' name, 1 object_id from dual),
         element as (
       select 1 profile from dual union all
       select 2 from dual)
    select le.profile,
       case WHEN ( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile) = 0
       THEN 'N'
       ELSE 'Y'
       END new_col
    from element le
       PROFILE N
             1 Y
             2 N

Maybe you are looking for