Function like decode ??

How write a function similar to decode which takes variables arguments?
My need is I need to get a concatanated string seperated by a separator indepedent of how many arguments I pass in to a function. How can I do that?
Any help/pointers is highly appreciated?

Thank you Richard.
But to you the orignial decode function is written like your delimit function ? (just curious). If you know javascript, that a function can be written in a way that it can many parameter without defining those slots in the function parameters. Is this possible with PL/SQL too? It would be great if it can.
Thank you again Richard, your solution you should be enough for me now.
I'm pretty sure it's impossible to do true variable parameter lists in PL/SQL. However, you can use defaults to create a comparable effect...
create or replace function delimit (
delimiter varchar2,
s1 varchar2,
s2 varchar2 := null,
s3 varchar2 := null,
s4 varchar2 := null,
s5 varchar2 := null,
s6 varchar2 := null)
return varchar2 is
s varchar2(32767) := s1;
begin
if s2 is not null then s := s || delimiter || s2; end if;
if s3 is not null then s := s || delimiter || s3; end if;
if s4 is not null then s := s || delimiter || s4; end if;
if s5 is not null then s := s || delimiter || s5; end if;
if s6 is not null then s := s || delimiter || s6; end if;
return s;
end;
/Now you can call this function with anywhere from 1 to 6 strings...
DELIMIT('','HELLO','WORLD')
Hello World
DELIMIT('','HELLO',NULL,'WORLD')
Hello World
DELIMIT(',','RED','BLUE','YELLOW','ORANGE','GREEN')
red,blue,yellow,orange,green
DELIMIT('->','RED','BLUE','YELLOW','ORANGE','GREEN')
red -> blue -> yellow -> orange -> greenJust add as many arguments as you'd like for the maximum (I think 255 is the limit in PL/SQL). Alternatively, you could pass in a table of strings as one argument and iterate through them.
Richard

Similar Messages

  • [SOLVED]:Is it possible to use functions like decode in 'setWhereClause()'?

    Hello,
    My requirement is that I have 2 poplists - Country and States.
    When I select a country,the corresponding states of that country should get populated in the states poplist.
    The approach I took is that :
    I selected firePartialAction as ActionType in Country poplist. Then I called a function to VOImpl of StatesVO and set the where clause there.
    Now I was thinking about using decode as there is no direct connection between the CountryVO and StatesVO.
    Is it possible to use functions like decode in 'setWhereClause()'?
    For Example:
    setWhereClause("DECODE(LOOKUP_TYPE,'XXC_IND_STATES','IND','XXC_US_STATES','US') = :1");
    setWhereClauseParam(0,Country);
    executeQuery();
    When I tried running the page,no error was given but when the country poplist was changed - there is no change in states poplist.
    If its not possible to use decode in setWhereClause(), could you please guide me as to how I can write a query to retrieve a value from a table and store it in a variable 'A'- so that I can pass that variable 'A' in setWhereClauseParam function .
    Message was edited by:
    Anju Susan

    That kewl, but for u knowledge u can add anything in ur where clause of query through ur code in Voimpl class. It is even possible to do change entire query, see Voimpl class methods in javadoc.
    --Mukul                                                                                                                                                                                                                                                                                                                                                                                                                           

  • To use Boolean function in DECODE or CASE statement

    Hi all
    I have a scenario where i need to use a boolean function inside DECODE statement. When i tried this way iam getting "ORA-06553: PLS-382: expression is of wrong type".
    I doubt whether i can use boolean function inside DECODE or not?
    My query will be like this:
    select decode(my_fuction( ),'TRUE',1,'FALSE',0) from dual;
    Any help is highly appreciated.
    Thanks
    Sriram

    Overloaded functions must differ by more than their
    return type . At the time that the overloaded
    function is called, the compiler doesn't know what type
    of data that function will return. The compiler cannot,
    therefore, determine which version of the function to
    use if all the parameters are the same.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Usage of BODS Functions (NVL,DECODE...) are stopping the FULL PUSH-DOWN

    Hi,
    It seems that the usage of BODS Functions like NVL and DECODE are leading to the partial PUSH-DOWN to the database.
    Is there any way to achive to the FULL PUSH DOWN (INSERT INTO DBTABLENAME)?
    Regards,
    Sudhakar

    Hello
    The optimiser determines if the whole dataflow can be pushed-down.  NVL and DECODE can be pushed-down to most databases, so its something to do with how you've built the dataflow.
    Things that stop full push-down
    1 - custom functions
    2 - complex statements
    3 - datatype conversions
    3 - complex dataflows with many transforms
    4 - some specific tranforms (DQ, pivot,etc.)
    With a bit of trial and error, you should be able to figure out which is stopping yours.
    Michael

  • How do I watch my iTunes movies, tv shows on my mac without having to download them all to my HD?  I really want my Mac to function like my Apple TV since I have just moved and don't have my TV for another few weeks. Help please?

    How do I watch my iTunes movies, tv shows on my mac without having to download them all to my HD?  I really want my Mac to function like my Apple TV since I have just moved and don't have my TV for another few weeks. Since I purchased my three Apple TV. I have had no need to download any of my movies to my Mac.  Which has been great.  However, I remember that I used to now have to do this... or did I?  I am just frustrated because I want to stream all this stuff vice haveing to waiting for it all to download fill up my Mac's HD and then just delete. Someone help please?

    Play the movie in iTunes to stream it.
    Click the cloud icon to download it.

  • How to use an external start button for 6024E w/ sc-2345, I would like it to function like a start button in LabView but I don't know how to connect the external button to the sc-2345's connector block

    I am confused as to how to connect my external start botton. I would like it to function like a start button on a front panel of a VI. I would like to use the +5V on pin 14 but I really don't know where to go from here. Any guidence for a novice would be most appreciated.

    phod,
    This is the LabVIEW Real-Time forum, so I suggest that in the future that you post this type of question to the Multifunction DAQ forum.
    For the simplest solution you will have to connect your button to a digital line of your board, consult the sc-2345 user manual for a diagram of where these lines are exposed. You will have to connect your start button in series with a line that is high, such as your 5V pin or another digital line. Then connect this to a digital line that will be your start trigger.
    Your program can poll the digital line that is connected to your button in a while loop and when it goes high, it lets the rest of the program execute. For the programming, I suggest you take a look at the shipping examples that come with LabVIEW. If yo
    u have LabVIEW 7.0 go to Help>>Find Examples. Open Hardware Input Output>>Traditional DAQ>>Digital Input and Output>>E Series for some examples of digital I/O programming with E-series boards.
    Hope that gets you started.
    Gerardo

  • Left outer join functions like simple join

    I created two views SCO_REQGROSSLINES_V & SCO_REQLINESCOMPLETE on Oracle requisitions base tables. Our business rules enforce the following identity: the number of gross requisition lines will always be greater than or equal to the number of requisition lines complete. (By complete I mean delivered.)
    Each view has a key named DATESUBINV_KEY constructed of a transaction date and the subinventory code using this logic:
    , TO_CHAR(TRUNC(transaction_date),'YYYYMMDD') || subinventory_code
    On 03-SEP-2010 a user created a requisition with one line item for material from the HEAT subinventory which was not delivered. This row is retuned in the result set when I query on SCO_REQGROSSLINES_V but is NOT returned when I query on SCO_REQLINESCOMPLETE. So far so good.
    When I issue either of the the following left outer joins I do not get the row for the row for the HEAT subinventory on 03-SEP-2010:
    select rgl.trxn_date
    , rgl.subinventory
    , rgl.line_count gross_line_count
    , rgl.ext_prc gross_value
    , rlc.line_count lines_filled
    , rlc.ext_prc lines_filled_value
    from SCO_REQGROSSLINES_V rgl left outer join sco_reqlinescomplete_v rlc
    ON rgl.datesubinv_key = rlc.datesubinv_key
    where rgl.TRXN_DATE BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
    and rlc.trxn_date BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
    order by rgl.trxn_date, rgl.subinventory
    select rgl.trxn_date, rgl.subinventory
    , rgl.line_count gross_line_count
    , rgl.ext_prc gross_value
    , rlc.line_count lines_filled
    , rlc.ext_prc lines_filled_value
    from SCO_REQGROSSLINES_V rgl
    , sco_reqlinescomplete_v rlc
    where rgl.TRXN_DATE BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
    and rlc.trxn_date BETWEEN to_date('29-AUG-2010') AND to_date('04-SEP-2010')
    AND rgl.datesubinv_key = rlc.datesubinv_key(+)
    order by rgl.trxn_date, rgl.subinventory
    Question: Why would the left outer joins function as a simple join on DATESUBINV_KEY? Do keys on views function differently than keys defined in the data dictionary? If they do how can I make these keys to function like data dictionary keys?

    Hi,
    The WHERE clause is applied after the outer join is completed. In your example, rows from rgl will be in the result set even if they have no match in rlc. In those cases, all the columns from rlc will be NULL.
    Okay, so you have these rows that contain data from rgl but NULLs where the data from rlc was supposed to go. Now it's time to start the WHERE clause. You then apply conditions like this in the WHERE clause:
    AND     rlc.trxn_date BETWEEN ...NULL is between anything, so the row that the outer join prodeuced is rejected.
    All conditions involivn columns from rlc probably need to be part of the join condition, not the WHERE clause.
    For example, in you first query the FROM and WHERE clauses might be:
    FROM          sco_reqgrosslines_v      rgl
    LEFT OUTER JOIN  sco_reqlinescomplete_v  rlc  ON    rgl.datesubinv_key   = rlc.datesubinv_key
                                            AND   rlc.trxn_date       BETWEEN TO_DATE ( '29-AUG-2010'
                                                                        , 'DD-MON-YYYY'
                                                  AND       TO_DATE ( '04-SEP-2010'
                                                              , 'DD-MON-YYYY'
    WHERE   rgl.trxn_date     BETWEEN TO_DATE ( '29-AUG-2010'
                             , 'DD-MON-YYYY'
                   AND     TO_DATE ( '04-SEP-2010'
                             , 'DD-MON-YYYY'
                             )Always use (at least) two arguments when calling TO_DATE.
    Conditions that only involve rgl can be in the WHERE clause, but if any conditions from rlc are in the WHERE clause, then the effect will be the same as an inner join.
    There no difference between tables and views (or sub-queries) in this regard: the same thing would happen regardless of whether rgl and rlc were really tables or not.

  • Does oracle have similar functionality like MsSql "for xml path('')"

    Does oracle have similar build in functionality like MsSql “for xml path(‘’)” , or in another word, it can enforce the result set(multiple rows) into ONE line such kind of presentation way.
    Thanks in advance. Any help would be greatly appreciated.

    Here I would like specify my question mnore clearly,
    CREATE TABLE t(
    line NUMBER(3),
    site VARCHAR2(4),
    phase VARCHAR2(5),
    test VARCHAR2(25));
    INSERT INTO t VALUES (1, '0100', '*','1111111111111111111111111' );
    INSERT INTO t VALUES (2, '0100', '=','2222222222222222222222222' );
    INSERT INTO t VALUES (3, '0100', '=','3333333333333333333333333' );
    INSERT INTO t VALUES (4, '0100', '*','4444444444444444444444444' );
    INSERT INTO t VALUES (5, '0100', '=','5555555555555555555555555' );
    INSERT INTO t VALUES (6, '0200', '*','6666666666666666666666666' );
    Here I want to retrieve the 'line' column information in ONE line way
    select line from t I want the result is like '1,2,3,4,5,6'
    Any generous help would be greatly appreciated!!!

  • Is there any function like malloc and free in labview?

    Im writing a vi that will handle my memory request.
    Im doing a very high speed video record sessions , and the frames cant be saves on hardisk in realtime), so im saving the frames on memory, and i want to use memory as
    much as i can(~2GB) and to save the maximum frames that i can save (and it depends on bit depth, height, width, total memory).
    VI Operations={
    Allocate Memory (frame width, frame height,TotalMemorySize) ,
    Add Frame(index) ,
    Get Frame (index),
    Free Memory
    In each record session, there will be a different FrameWidth and Height, so the maximum frame that i can save in memory may be different and equal to
    IndexMax=TotalMemorySize/(FrameWidth*FrameHeight)
    Im doing this by allocating a 3D array [FrameIndex , row , column]
    The fact that the width and height change in different sessions indicate  that i need an ability to free the previous allocated 3D array memory and allocate a new one.
    (lets say that i have 2GB total memory..)

    This request really takes the system and the programmer to the limits....
    First of all:
    LabVIEW does not have any functions like malloc and free. LV wants to prevent the user to have to think about stuff like this. On the other hand, the memory management in LV is therefore hard to do or even impossible, at least to such an extend as you request.
    Some thoughts about your application:
    1. If you want to have about 2GB of framedata in RAM during runtime, you will need the large memory awareness active. Otherwise, a 32 bit OS will give you "out of memory" messages. Refer to the LV help "VI memory usage".
    2. Storing the data in an array could be a difficult task. Arrays have to be in memory without any gap. Therefore, you'd encounter "out of memory" messages even if your RAM totals enough free memory (theoretical).
    3. The idea of linked-lists does not compy in LV since you cannot store pointers to structs (since those are abstracted from the user).
    4. Maybe you should take a look into vision. 
    hope this helps,
    Norbert 
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How to implement a back functionally like the back of the browser

    Hi, I have a commandImageLink("go back") in a template jspx. How to implement the back functionally like the back of the browser with a managed bean method??. For know I m not using task flows.

    I think you can use a javascript method to go back to the previous browser page.
    http://javascript.about.com/library/blback.htm
    http://www.pageresource.com/jscript/jhist.htm
    http://www.w3schools.com/jsref/met_his_back.asp
    Perhaps you find something useful and related to backing beans here:
    http://adfdevelopers.blogspot.com/2009/04/some-handy-code-for-backing-beans-adf.html
    NA
    http://nickaiva.blogspot.com

  • Is possible in a dialog screen attach a field functional like select-option

    hi,
       Is it possible - in a dialog screen - to attach a field that has functionality like Select-options fields?
    And if so - how?
    and information about complex_selections_dialog

    Hi,
    Look at the below links
    module pool programming " to add selection-option on screen"
    module pool programming " to add selection-option on screen"
    Regards
    Sudheer

  • How to call C++ function like this...

    hi!everyone!
    i have a C++ function like this:
    java_call_c::test()
    how do i write codes in java in order to call the function ???
    thanksa lot !!!

    Actually there is no way to write C code with C++ functions (as well as you can't call Pascal functions).
    But you can create function in C style to call C++ function.
    void test( )
      java_call_c c = new java_call_c( );
      c->test( );
      delete c;
    }:)

  • Is there a System Menu for special Functions, like WIPE CACHE?

    On my DX, there was a method of pressing and holding the Menu button & Power up button to get to special "Systems" functions like WIPE CACHE & FACTORY RESET. Does such a procedure exist for the Razr ?  I know about SAFE MODE and was able to see that work. (Although my finger hurt having to press the up/down Volume buttons for so ling. )

    While I have done this quite a few times (and this has made my phone a bit more responsive when it gets sluggish) you should be careful and watch what you are doing. If you select the wrong menu option you may end up having to contact Verizon for support.
    Wiping the cache partition
    Power the phone off
    Press and hold the volume down, volume up and power button until the recovery screen appears.
    Use the volume down button to select "Recovery" and then press the volume up to confirm the selection.
    The phone will do a little reboot thing, display the dual core logo thing and then an Android next to a triangle with a yellow exclamation point will appear. At this point press the volume up and volume down buttons at the same time.
    If you did everything correctly you are now at the Android System Recovery Screen. To clear the cache press the volume down button until you have selected "wipe cache partition". Press the power button to confirm the selection and it will wipe the cache partition.
    Once the cache is cleared press the volume up button to select "Reboot System Now" and press the power button to confirm the selection. If the "Reboot System Now" is already selected then just press the power button to confirm the selection and the phone will reboot.

  • Using financial functions like xirr,irr,npv

    Hi Guys!,
    I would like to make use of financial functions like xirr,irr,npv using oracle/forms/sql , is there any resource available in oracle product family, if no how can i use there functions using oracle products.
    Thanks in advance
    Uday

    I'm unsure which Oracle product might include built-in financial functions -- perhaps one their Business Intelligence products? If your math and Java skills are up to the task, you might consider writing a JavaBean that contains your own implementations of the financial functions you require.
    Eric Adamson
    Lansing, Michigan

  • Ai Beginner, Can I make the pen tool function like it does in Photoshop?

    I have been using photoshop to do various things over the last few years, and I am trying to move over to Illustrator. The biggest problem I have already is the function of the pen tool in Ai as opposed to Ps. I have to select an entirely different tool to move points? I can't just hold control and move the point? Is there a way that I can make the hot keys and what not function like the pen tool does in Ps. Why the change in the first place?
    (Also, I am using CS4)

    A feature request maybe? But then there's no-one from Adobe listening out there anyway, so what's the point?
    That's not at all true I have made many feature reques and had quite a few realized. Although one of the bestones was killed.
    But if you make a feature request the right way and you give a good argument for it they will look at it and see if they think it is practical for them to implement.
    The key is practical and a really good reason for the feature.
    And I do know from experience.

Maybe you are looking for

  • Replay only particular logs (before a certain date) to restored Exchange 2010 database?

    Hello, I'm doing Exchange 2010 database full backup using windows server backup (windows 2008 R2) every weekend. I have a Mac user which Mac Outlook 2011 which somehow managed to corrupt his mailbox. I.e. on Wednesday many messages and contacts disap

  • IPhone 6 iOS 8.1 - Photos blank / preview corrupt after restore from backup

    Hello, I just restored from a recent backup of an iPhone 5s @iOS 8.1 (from today) to a new iPhone 6, also on iOS 8.1. Everything else is ok, except the photo library. Only those images that have been edited within in iPhone 5s stock photos app over t

  • IPhone 3GS not recognized by iTunes on Mac

    I have not been able to synch my phone since upgrading to most current version of iTunes. I have followed the instructions from apple help on how to uninstall and reinstall iTunes. I have done that twice now. Didn't work. I have also reset my phone p

  • Can't able to write reviews in the AppStore

    Hi everyone, I have used AppStore a long time and I never had problem like this. Once all my reviews from iTunes was removed and even in my iTunes account setting there is no Review section under my iTunes nickname. So now I can't leave review for th

  • Inventory onhand quantities Report.

    Hi Everyone, I have a requirement regarding Inventory, a report needs to show the details of inventory like Unusable_Quantity, Available_Quantity, Onhold_Quantity, Total Can any one help me in this. Regards Vamsi Edited by: 965678 on May 6, 2013 2:13