Is it possible to increment a value in a function

is it possible to increment a value dynamically with in a function

CREATE OR REPLACE function TEST
(V_COUNT in NUMBER(10),V_LP in NUMBER(3),V_COUNTER in NUMBER(10))
RETURN varchar2(40)
IS
V_NAME varchar2(40);
BEGIN
IF (V_COUNT = 1)
     THEN
     --some code
     EXIT;
ELSIF (V_COUNT > 1)
     V_LP:=0;
     V_COUNTER:=1;
     WHILE ( V_COUNTER = 1 )
     LOOP
          V_LP:=V_LP + 1;
          --SOME CODE
     END LOOP;
     IF ( V_LP = 1 )
     THEN
          --SOME CODE               
     END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE(SQLERRM);
END;
THIS IS MY CODE

Similar Messages

  • Where it is possible to change the value separator in Custom Field?

    Hello,
    This is a question around the "Custom Fields" and "Lookup Table"
    I linked a "Custom Field" to a "Lookup Table".
    I select the option "Allow multiple values to be selected from lookup table"
    When I used this "Custom Field" in a view, the selected values are separated by a comma ",".
    Where it is possible to change this value?
    I saw another project server where the character is a semi-column ";" and I would like to test with ";".
    Thank you in advance
    Pascal Jean

    Hi,
    This will be triggered by your regional settings.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |
    Hello,
    Thank you for the answer.
    Do you mean the "local regional settings"?
    Because, depending on the PWA site I'm connected to I don't have the same values. I'm obviously using the same workstation.
    Regards

  • After download itunes installation began in windowx xp near the end of the installation the message says: it was not possible to write the value to the key Software / Classes / .mpg / OpenWithList / iTunes / .exe. Already reinstalled 3 times and always sa

    After download itunes installation began in windowx xp near the end of the installation the message says: it was not possible to write the value to the key Software / Classes / .mpg / OpenWithList / iTunes / .exe.
    Already reinstalled 3 times and always says the same message.
    thank you

    Only two had virus on windows XP this week and wiped them with Avast. The itunes asked me to install the update, and so I did. but it always gives me that message.

  • Parameter validation failed. It is not possible to provide valid values for all parameters

    I'm trying to test passing in parameter values from the URL.    I have RS 2008 .   I created an ultrasimple report based on a stored procedure output.  There is no validation, No available values, No default values.  
    I'm trying to run the report like this:
    /Reports/Pages/Report.aspx?ItemPath=%2fProduction%2fDBA+Reports%2fTest&iTest=1
    I get:
    Parameter validation failed. It is not possible to provide valid values for all parameters. (rsParameterError)
    the one int parameter is iTestId 
    The RS log file says the following:
    processing!ReportServer_0-54!9138!01/25/2013-09:22:51:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Parameter validation failed. It is not possible to provide valid values for all parameters., ;
      Info: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Parameter validation failed. It is not possible to provide valid values for all parameters.
    What am I missing?

    Hi F-ram,
    From your description, you want to pass multiple parameters via URL, right? To pass multiple parameters through URL, we can use an ampersand (&) to separate them. For example, I have a report with two parameters p1 and p2. The report is deployed in a
    folder on the Report Server. When I navigate to the report on the Report Server, I can see the report URL is http://localhost/ReportServer_SQL2008NEW/Pages/ReportViewer.aspx?%2fFolder%2fReport&rs:Command=Render.
    If I need to pass parameters through URL, I can just add &p1=value1&p2=value2 at the end of the URL and the entire URL would be http://localhost/ReportServer_SQL2008NEW/Pages/ReportViewer.aspx?%2fFolder%2fReport&rs:Command=Render&p1=value1&p2=value2
    If you have any questions, please feel free to ask.
    Regards,
    Charlie Liao
    Charlie Liao
    TechNet Community Support

  • Error in self increment varible value using "FORALL"

    CREATE OR REPLACE PROCEDURE BULK_COLLCT_PASS
    AS
    TYPE VAR_TYP IS VARRAY (32767) OF VARCHAR2 (32767);
    V_DSH_CM_NUMBER VAR_TYP;
    V_DSH_DATE VAR_TYP;
    V_DSH_TIME VAR_TYP;
    V_DSD_CM_NUMBER VAR_TYP;
    V_PLU_CODE VAR_TYP;
    V_DSD_DATE VAR_TYP;
    V_str_id VAR_TYP;
    LN_ITM NUMBER:=0;
    str_id number := 30001;
    CURSOR CUR_DBMG_SAL_HEAD
    IS
    SELECT DSH.CM_NUMBER,D_DSH_CM_DATE, D_DSH_CM_TIME
    FROM DBMG_SAL_HEAD DSH
    WHERE ROWNUM<6;
    BEGIN
    OPEN CUR_DBMG_SAL_HEAD;
    LOOP
    FETCH CUR_DBMG_SAL_HEAD BULK COLLECT
    INTO V_DSH_CM_NUMBER,
    V_DSH_DATE,
    V_DSH_TIME;
    FOR indx IN V_DSH_CM_NUMBER.FIRST .. V_DSH_CM_NUMBER.LAST
    LOOP
    SELECT CM_NUMBER, PLU_CODE,V_DSH_DATE(indx)
    BULK COLLECT
    INTO V_DSD_CM_NUMBER, V_PLU_CODE,V_DSD_DATE
    FROM DBMG_SAL_DETL DSD
    WHERE DSD.CM_NUMBER = V_DSH_CM_NUMBER(indx);
    --block1
    Ln_Itm := 0;
    FOR ind IN 1..V_DSD_CM_NUMBER.COUNT
    loop
    INSERT INTO PC_ALL_TAB
    VALUES(V_DSH_CM_NUMBER(indx),
    V_DSD_DATE(ind),
    V_DSD_CM_NUMBER(ind),
    V_PLU_CODE(ind),
    LN_ITM,
    str_id
    LN_ITM := LN_ITM +1;
    end loop;
    --block2                 
    END LOOP;
    EXIT WHEN CUR_DBMG_SAL_HEAD%NOTFOUND;
    END LOOP;
    commit;
    CLOSE CUR_DBMG_SAL_HEAD;
    DBMS_OUTPUT.PUT_LINE('COMPLETE..!');
    END ;
    Hi,
    I am using above code in which when code between "--block1 & --block2" is incrementing ln_itm value by 1 each time.
    so that after completion of code o/p is as below.
    SELECT DSH_CM_NUMBER, LN_ITM FROM PC_ALL_TAB;
    DSH_CM_NUMBER     LN_ITM
    1     4177424     0
    2     4177422     0
    3     4177426     0
    4     4177426     1
    5     4177426     2
    6     4177425     0
    7     4177427     0
    8     4177427     1
    9     4177427     2
    for each repeating value of cm_number its incresing by 1.
    but i wan to change "--block1 to --block2" in "FORALL". i did this but i m nt getting o/p is incresing value of ln_itm.
    kindly help me...
    code after changed to "FORALL"
    CREATE OR REPLACE PROCEDURE BULK_COLLCT_PASS
    AS
    TYPE VAR_TYP IS VARRAY (32767) OF VARCHAR2 (32767);
    V_DSH_CM_NUMBER VAR_TYP;
    V_DSH_DATE VAR_TYP;
    V_DSH_TIME VAR_TYP;
    V_DSD_CM_NUMBER VAR_TYP;
    V_PLU_CODE VAR_TYP;
    V_DSD_DATE VAR_TYP;
    V_str_id VAR_TYP;
    LN_ITM NUMBER:=0;
    str_id number := 30001;
    CURSOR CUR_DBMG_SAL_HEAD
    IS
    SELECT DSH.CM_NUMBER,D_DSH_CM_DATE, D_DSH_CM_TIME
    FROM DBMG_SAL_HEAD DSH
    WHERE ROWNUM<6;
    BEGIN
    OPEN CUR_DBMG_SAL_HEAD;
    LOOP
    FETCH CUR_DBMG_SAL_HEAD BULK COLLECT
    INTO V_DSH_CM_NUMBER,
    V_DSH_DATE,
    V_DSH_TIME;
    FOR indx IN V_DSH_CM_NUMBER.FIRST .. V_DSH_CM_NUMBER.LAST
    LOOP
    SELECT CM_NUMBER, PLU_CODE,V_DSH_DATE(indx)
    BULK COLLECT
    INTO V_DSD_CM_NUMBER, V_PLU_CODE,V_DSD_DATE
    FROM DBMG_SAL_DETL DSD
    WHERE DSD.CM_NUMBER = V_DSH_CM_NUMBER(indx);
    --block1
    /*Ln_Itm := 0;
    FOR ind IN 1..V_DSD_CM_NUMBER.COUNT
    loop
    INSERT INTO PC_ALL_TAB
    VALUES(V_DSH_CM_NUMBER(indx),
    V_DSD_DATE(ind),
    V_DSD_CM_NUMBER(ind),
    V_PLU_CODE(ind),
    LN_ITM,
    str_id
    LN_ITM := LN_ITM +1;
    end loop; */
    FORALL ind IN 1..V_DSD_CM_NUMBER.COUNT
    INSERT INTO PC_ALL_TAB
    VALUES(V_DSH_CM_NUMBER(indx),
    V_DSD_DATE(ind),
    V_DSD_CM_NUMBER(ind),
    V_PLU_CODE(ind),
    LN_ITM,
    str_id
    LN_ITM := LN_ITM +1;
    --block2                 
    END LOOP;
    EXIT WHEN CUR_DBMG_SAL_HEAD%NOTFOUND;
    END LOOP;
    commit;
    CLOSE CUR_DBMG_SAL_HEAD;
    DBMS_OUTPUT.PUT_LINE('COMPLETE..!');
    END ;
    o/p :- SELECT DSH_CM_NUMBER, LN_ITM FROM PC_ALL_TAB;
    DSH_CM_NUMBER     LN_ITM
    1     4177424           0
    2     4177422           1
    3     4177426           2
    4     4177426           2
    5     4177426           2
    6     4177425           3
    7     4177427           4
    8     4177427           4
    9     4177427           4
    I need result as below...but using "FORALL"
    DSH_CM_NUMBER     LN_ITM
    1     4177424     0
    2     4177422     0
    3     4177426     0
    4     4177426     1
    5     4177426     2
    6     4177425     0
    7     4177427     0
    8     4177427     1
    9     4177427     2

    Double post
    How to increment value using "FORALL" instead of for loop

  • Is it possible to use the value of a string to reference a component in the

    I'm fairly new to Java so this may be a stupid question!
    Is it possible to use the value of a string to reference a component in the code? For example in the code below, Wall is a class holding 3 different arrays. The Robot class has an array called finishBricks. When the buildWall method is run it receives the integers width and height which are used to construct the dimensions string. I want to use this string to then load the appropriate Wall array into the finishBricks array.
    I hope this makes sense! Any help would be greatly appreciated!
    class Robot {
    public double[][] finishBricks;
    public void buildWall(int width, int height) {
    Wall w = new Wall();
    String dimensions = "Wall" width "x" +height;
    this.finishBricks = w.xxxx; // where xxxx is replaced by whatever the String dimensions is
    class Wall {
         public double[][] Wall4x2 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-13.55,27.45},
              {-30.00,-20.35,27.45},
              {-30.00,-22.00,28.65},
              {-30.00,-16.85,28.65},
              {-30.00,-10.05,28.65},
              {-30.00,-03.25,28.65}
         public double[][] Wall3x3 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-13.55,27.45},
              {-30.00,-15.20,28.65},
              {-30.00,-10.05,28.65},
              {-30.00,-03.25,28.65},
              {-30.00,-01.60,29.85},
              {-30.00,-06.75,29.85},
              {-30.00,-13.55,29.85},
         public double[][] Wall2x4 = {
              {-30.00,-01.60,27.45},
              {-30.00,-06.75,27.45},
              {-30.00,-08.40,28.65},
              {-30.00,-03.25,28.65},
              {-30.00,-01.60,29.85},
              {-30.00,-06.75,29.85},
              {-30.00,-08.40,31.05},
              {-30.00,-03.25,31.05},

    Map walls = new HashMap ();
    walls.put ("2x2", new double[][] {
        new double[] {
            1,
            0
        new double[] {
            0,
            1
    double[][] wall = (double[][]) walls.get ("2x2");

  • Is it possible to set valid values at run time?

    Hi,
    I'am using a BPM Presentation and I want to know if it is possible to set the values of a combo box depending of the value of other field in the same presentation ando if so how to do it? I tried to do somethin like:
    var = fiedlValidValues()
    I tried to use refreshValidValues but it says that cannot execute the action in a presentation, I don&acute;t know wath else to do
    but it doesn&acute;t works, any idea??
    Thanks in advance
    Marig
    Edited by: user646988 on 05-feb-2009 19:30

    Hi, thanks Anup
    I followed your advise but i didn&acute;t success. I have question, if I'm getting the default values of a field with a method using a query. The type field is String and I'm using it into a combo box so the method I'm using returns a String[], is something like this:
    for each row in SELECT column
    FROM DataBase.SYSBPM.TABLE
    where var1 = var2
    do
    clases[] = row.clase
    end
    return clases
    But if I use a method for the onChange property if the field how to set the default values?
    I tried with
    for each row in SELECT column
    FROM DataBase.SYSBPM.TABLE
    where var1 = field1
    do
    clases[] = row.clase
    end
    clases = claseValidValues()
    But this is not working, do you have any ideas??
    Thanks
    Edited by: user646988 on 15-feb-2009 19:36

  • Is it possible to sort dimension values in order different from alphabetic?

    Is it possible to sort dimension values in order different from alphabetic. &#1058;&#1086; use this sorting in BI Beans. In 10g r2 with awm 10.2.0.2. I try to add attribute like it was show in this forum, but nothing changes.

    Could be usefull if you use java AW api... here's the java code I'm using to create the sort_order attribute
    Dimension myDim = yourAW.findDimension("DIMNAME");
    Attribute myAttr = myDim.createAttribute();
    myAttr.setName("freename");
    myAttr.setClassification("DEFAULT_ORDER");
    myAttr.setIsDefaultOrder(true); // TO NOT FORGET
    myAttr.setDataType("INTEGER");
    myAttr.Create(AWConnection);
    globalAW.Commit(AWConnection);
    It creates a variable - integer - that defines the default order of the dim values. I'm viewing it with AWM and BIBeans. The order is respected with Level-based and Value-based hierarchy but my hierarchies are really simple and unique for all the dimensions.
    BUT !!!! Be carefull, if you don't have any hierarchy in your dimension, you must have at least one level - the default NONE level. Otherwise, it won't work ???

  • How to Increment a Value by 1 in each execution of a Package

    Hi All,
    Below is a brief about my requirement,
    We have a requirement that we need to send workflow notification reminders 3 times with prefix like
    1st notification with prefix "REMINDER# 1"
    2nd notification with prefix "REMINDER# 2"
    3rd notification prefix "REMINDER#3 ", and these notifications will time out every 2 hrs.
    so the logic should be handled in PLSQL, i am not sure how can i achieve this.
    I have declared a variable and incremented the value by 1, we will execute the below block 3 times, the problem is all the time the value remains as 1 and lc_prefix is always  REMINDER#1 in all the notifications.
    Please advise a solution for this.
    when i execute the PLSQL block first time the value should be 1, if i execute the same block again the value should be 2 and 3 time the value should be 3.
    DECLARE
    ln_loop_count   NUMBER         := 0;
    BEGIN
    ln_loop_count=ln_loop_count+1
    IF ln_loop_count = 1
          THEN
             lc_prefix := 'REMINDER#1:';
          ELSIF ln_loop_count = 2
          THEN
             lc_prefix := 'REMINDER#2:';
          ELSIF ln_loop_count = 3
          THEN
             lc_prefix := 'REMINDER#3:';
          ELSE
             lc_prefix := NULL;
          END IF;
    END;
    Thanks,
    CSK

    Hi,
    CSK wrote:
    Hi All,
    Below is a brief about my requirement,
    We have a requirement that we need to send workflow notification reminders 3 times with prefix like
    1st notification with prefix "REMINDER# 1"
    2nd notification with prefix "REMINDER# 2"
    3rd notification prefix "REMINDER#3 ", and these notifications will time out every 2 hrs.
    so the logic should be handled in PLSQL, i am not sure how can i achieve this.
    I have declared a variable and incremented the value by 1, we will execute the below block 3 times, the problem is all the time the value remains as 1 and lc_prefix is always  REMINDER#1 in all the notifications.
    Please advise a solution for this.
    when i execute the PLSQL block first time the value should be 1, if i execute the same block again the value should be 2 and 3 time the value should be 3.
    DECLARE
    ln_loop_count   NUMBER         := 0;
    BEGIN
    ln_loop_count=ln_loop_count+1
    IF ln_loop_count = 1
          THEN
             lc_prefix := 'REMINDER#1:';
          ELSIF ln_loop_count = 2
          THEN
             lc_prefix := 'REMINDER#2:';
          ELSIF ln_loop_count = 3
          THEN
             lc_prefix := 'REMINDER#3:';
          ELSE
             lc_prefix := NULL;
          END IF;
    END;
    Thanks,
    CSK
    Are you sure this is the code you're running?  It looks like it would raise an error because you're using =  where := is required:
    ln_loop_count=ln_loop_count+1
    The answer to your question is in the title of your thread.  You want a package, not an anonymous block.  An anonymous block is compiled anew every time you run it.  A package can contain variables (such as ln_loop_count in the example below) that last as long as your database session lasts.
    Here's one way to do what you requested:
    CREATE OR REPLACE PACKAGE  pkg_lc
    AS
        FUNCTION get_lc_prefix
        RETURN VARCHAR2;
    END   pkg_lc;
    SHOW ERRORS
    CREATE OR REPLACE PACKAGE BODY  pkg_lc
    AS
        ln_loop_count PLS_INTEGER := 0;
        FUNCTION get_lc_prefix
        RETURN VARCHAR2
        IS
        BEGIN
            ln_loop_count := ln_loop_count + 1;
            RETURN  'REMINDER#' || ln_loop_count;
        END  get_lc_prefix;
    END  pkg_lc;
    SHOW ERRORS
    You can call the function in PL/SQL like this:
    str := pkg_lc.get_lc_prefix;
    or in SQL like this:
    SELECT  pkg_lc.get_lc_prefix
    FROM    dual;
    The package name is optional  when you call the function from inside the package itself.
    You may want (or need) to store the counter in a table, rather than in a package variable.

  • Re:Is it possible to copy the values of KP26 of 2010 to 2011?

    Dear Friends,
    Is it possible to copy the values of KP26 of 2010 to 2011?
    Moderator: Please, avoid asking basic questions

    Thank My Dear Friend.
    Regards,
    Hari

  • Is it possible to change the value of "maxdatafiles" after creating a db??

    Hi, all.
    Is it possible to change the value of the followings after creating a database??
    -maxdatafiles
    -maxinstances
    -maxlogfiles
    -maxlogmembers
    -maxloghistory
    Thanks and Regards.

    Hi Chris,
    Thanks for updating that but here's what in Oracle Doc:
    From Oracle Documentation (Oracle® Database New Features Guide 10g Release 2 (10.2))
    Eliminate Control File Re-Creation
    With the control file enhancements, there is no longer a requirement to re-create the control file when changes in the configuration parameters are made. These include the MAXLOGFILE, MAXLOGMEMBERS, MAXLOGHISTORY, MAXDATAFILES, and MAXINSTANCES parameters.
    This feature eliminates database downtime when a configuration parameter change is made in the control file
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14214/chapter1.htm#sthref12
    Regards

  • Increment the Value on the Target side

    Hi
    I am working on Proxy to SOAP Scenario in PI 7.1 and I have an unbounded structure on the sender side (Business Partner) which I will be receiving multiple records at a time and have the Unbounded Structure on the receiver side which I have mapped directly.
    Here is the issue
    Based on the no of Records on the Sender side I need to increment the value and assign it to Data element which is on the receiver side
    For Instance
    If have Business Partners as 4 on the sender side, I need to assign as ClaimsParty-001, ClaimsParty-002, ClaimsParty-003 and ClaimsParty-004 to one the data eleement on the receiver side, i.e Incrementing the value on the receiver side,
    Experts Please let me know how can I do this
    Thanks
    PR

    Please let me how can I use the Index Function
    Proceed as below:
    Source ---> Index
                               ---------->less(arithmetic) ----> IfWithElse
                    Constant(10)
    Input for Then part of the above IfWithElse:
    Constant(00)
                         ---------->Concat ------>Then
    Source ----> Index
    Input for the Else part of the above IfWithElse (executed when count becomes more than 9):
    Constant(0)
                         -----> Concat ----> Else
    Source----> Index
    Index function should be:
    Initial, Increment value = 1
    Reset Index ---> Set to Do not Reset Index to Initial Value.
    Check it and let me know for an issue
    Regards,
    Abhishek.

  • Is there possibility to add dimension value into hierarchy using dml or spl

    1 Is there possibility to add dimension value into hierarchy using dml or spl?
    If such possibility exists how to do that.
    2 Is it possible to sort dimension values inside one branch of the hierarchy?

    What version of OLAP are you using and how did you create your AW (e.g., AWM)?
    Assuming that you're used either AWM or the Java API for AWs in 10g, there isn't an OLAP DML for adding a dimension member to a dimension (and have all the meta data kept in sync); you must load dimension members using AWM the Java API for AWs.
    So, make your changes in the the dimension table and process that table.
    For sorting, you can add a sort attribute to the dimension. Add the sort attribute to the model, indicate that it's used for sorting, add the sort attribute to your dimension table and maintain the dimension.

  • Is it possible to get the value of variable through answers page ?

    Hi all,
    I had Dynamic variable ETLRundate . I want use this variable in Answers page to see the out put ?
    Is it possible to get the value of variable through answers page ?if so how I can use ?

    Hi
    Use the link below and download the documentation
    http://www.oracle.com/technology/documentation/bi_ee.html
    I think you will find what you are looking for in the Answers, Delivers, and Interactive Dashboards User Guide, but in short the syntax to display a variable value is as follows:
    As shown above the syntax for using a presentation variable is:
    @{variablename}{defaultvalue}
    For Session variables use:
    @{biServer.variables['NQ_SESSION.variablename']}
    For repository variables use:
    @{biServer.variables['variablename']}
    Rgds
    Ed

  • Is it possible to pass selected value from one jsp to another jsp page?

    In my welcome page(in jsp), if the user is selecting some values, is it possible to pass those values to another jsp page and display?
    If yes, how can it be done?
    please help..

    Yes, you would have to make the motion from one page to the next submit a form. Then on the second JSP you can use request.getParameter("nameOfInputField") to get the value the user selected.

Maybe you are looking for