PL/SQL - column value is updated as 0 instead of numeric value

Declare
v_cnt varchar2(20);
v_cnd varchar2(20);
v_total varchar2(20);
begin
select count(emp_id) into v_cnt from emp1;
select count(emp_id) into v_cnd from emp2;
v_total:=v_cnt+v_cnd;
dbms_output.put_line('before');
dbms_output.put_line(v_total);
update emp3 set total_emp=v_total where dept_no=40;
commit;
dbms_output.put_line('after');
dbms_output.put_line(v_total);
end;
In the above program, value for the column total_emp is getting updated as 0 instead of numeric value. However, when I use dbms_output statement to print the value, for both the cases, before and after , I'm getting the numeric value for the variable v_total.
v_total value is not getting updated to column value in table.
table column definition for total_emp is varchar2(20).
Also, I tried to hard code value for total_emp column in the above statement and it worked.
So, the problem is variable value when used in the update statement it's not getting updated to column.
Please help me.

Post a reproducable test case for us...
SQL> create table emp1 as select * from emp;
Table created.
SQL> create table emp2 as select * from emp;
Table created.
SQL> create table emp3 as select * from emp;
Table created.
SQL> alter table emp3 add (total_emp varchar2(20));
Table altered.
SQL> ed
Wrote file afiedt.buf
  1  Declare
  2    v_cnt varchar2(20);
  3    v_cnd varchar2(20);
  4    v_total varchar2(20);
  5  begin
  6    select count(empno) into v_cnt from emp1;
  7    select count(empno) into v_cnd from emp2;
  8    v_total:=v_cnt+v_cnd;
  9    dbms_output.put_line('before');
10    dbms_output.put_line(v_total);
11    update emp3 set total_emp=v_total where deptno=10;
12    commit;
13    dbms_output.put_line('after');
14    dbms_output.put_line(v_total);
15* end;
SQL> /
before
28
after
28
PL/SQL procedure successfully completed.
SQL> select * from emp3;
     EMPNO ENAME      JOB              MGR HIREDATE                    SAL       COMM     DEPTNO TOTAL_EMP
      7369 SMITH      CLERK           7902 17-DEC-1980 00:00:00        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-1981 00:00:00       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-1981 00:00:00       1250        500         30
      7566 JONES      MANAGER         7839 02-APR-1981 00:00:00       2975                    20
      7654 MARTIN     SALESMAN        7698 28-SEP-1981 00:00:00       1250       1400         30
      7698 BLAKE      MANAGER         7839 01-MAY-1981 00:00:00       2850                    30
      7782 CLARK      MANAGER         7839 09-JUN-1981 00:00:00       2450                    10 28
      7788 SCOTT      ANALYST         7566 19-APR-1987 00:00:00       3000                    20
      7839 KING       PRESIDENT            17-NOV-1981 00:00:00       5000                    10 28
      7844 TURNER     SALESMAN        7698 08-SEP-1981 00:00:00       1500          0         30
      7876 ADAMS      CLERK           7788 23-MAY-1987 00:00:00       1100                    20
      7900 JAMES      CLERK           7698 03-DEC-1981 00:00:00        950                    30
      7902 FORD       ANALYST         7566 03-DEC-1981 00:00:00       3000                    20
      7934 MILLER     CLERK           7782 23-JAN-1982 00:00:00       1300                    10 28
14 rows selected.Works for me.. even with the incorrect datatypes.
You demonstrate exactly what you are doing.

Similar Messages

  • In formula column - I am getting current year - but get numeric value error

    Hello
    I defined a formula column as folllows:
    function CF_1Formula return char is
    thisyear char;
    begin
         select to_char(sysdate,'YYYY')
         into thisyear
         from dual;
         return thisyear;
    end;
    I get - Fatal Pl/Sql error. numeric or value error. What am I doing wrong here?

    Or replace the whole thing with
    RETURN to_char(sysdate,'YYYY');
    saving a pointless round trip to the database.

  • Regarding "Change Indicator + History Column + Refresh After Update"

    Hi,
    In our app, we are not using any separate column for change indicator and using LastUpdateDate as both Change Indicator and History Column(Modified On) as well.
    The problem is that when 'Refresh After Update' option is not selected for this column, then RowInconsistentException is throw on commit for multi user scenario, and when 'Refresh After Update' option is selected for this column, then exception is not thrown but value is also not updated. Here is the summary of observations:
    Settings for LastUpdateDate Column:
    Only Setting History Column (Modified on)
    Single User - Value Updated , no exception is thrown.
    Multi User - throws (oracle.jbo.RowInconsistentException) JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[3 ]. for second user.
    History Column ( Modified on ) & Change Indicator property checked.
    Single User - Value Updated , no exception
    Multi User - throws (oracle.jbo.RowInconsistentException) JBO-25014: Another user has changed the row with primary key oracle.jbo.Key[3 ]. for second user.
    History Column ( Modified on ) & Change Indicator property checked & Refresh After Update option enabled.
    Single User - Value not updated, no exception thrown
    Multi User - Value not updated, no exception thrown
    What I want is that in multi user scenario, the value of LastUpdateColumn should be updated and no exception should also be thrown.
    Is this a bug in ADF Techstack or am I missing something?
    Thanks,
    Lalit.

    First and Second scenario are as expected.
    1) Only Setting History Column (Modified on)-> Last updated value will be updated when a user changes anything in that entity. But if another user tries to update the entity on top of a stale state then lost update detection is performed by ADF by comparing every attribute of entity against current values in database. So it will give error.
    2) History Column ( Modified on ) & Change Indicator property checked.
    Same thing will happen as in case of first scenario but this time detection of lost update will be more efficient as framework will check only that column for "lost update" detection for which change indicator is selected.
    But for the third one where you have selected the history column LastUpdatedDate as a change indicator with "Refresh On Update" selected, the behaviour is strange. I do not know why the last updated date is not updated after a commit. It does not throw any error also which it actually should. It is not detecting lost updates in this scenario. Probably because the only change indicator LastUpdatedDate is not changed.
    Regards,
    Harmeet

  • Update a table based on Min value of a column of a Another Table.Pls Help.

    Dear All,
    Wishes,
    Actually I need update statement some thing like below scenario...
    Data in table is like below:
    I wrote a query to fetch data like below ( actually scenario is each control number can have single or multiple PO under it ) (i used rank by to find parent to tree like show of data)
    Table: T20
    Control_no        P_no  Col3
    19950021     726473     00
    19950036      731016     00
    19950072     731990     00
                     731990 01
    19950353     734732     00
                     734732 01
    19950406     736189     00
                 736588     01
                 736588     02
                 736588     03                
    Table : T30
    Control_no      P_no              col3
    19950021     726473 
    19950036     731016
    19950072     731990     
                 731990     
    19950353     734732     
                  734732     
    19950406     736189     
                  736588     
                  736588     
                   736588     
      Now requirement is I need to update Table T30's col3 (which do have values in T20 but not this table) in such a way that , It should take MIN (COL3) from T20 and then update that value to related Col3)
    Better I can explain through below new data format in T30 after update:
    After update it should like:
    Table : T30
    Control_no       P_no    col3 (this is updated column)
    19950021     726473   00  -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
    19950036     731016   00  -- as this is min value for Pno 726473 belongs to Control NO 199950021 in Table T20 above
    19950072     731990   00  -- see here..both Pno should updated as '00' as MIN value col3 in Table T20 related to this
                 731990      00     record is '00'  (out of 00,01 it should select 00 and update that value here)
    19950353     734732      00  -- same again both Pno should updated as '00' as MIN value col3 in TableT20 related to this
                 734732      00     record is '00'  (out of 00,01 it should select 00 and update that value here)
    19950406     736189      00  -- As there is single col3 value in T20, 00 should be updated here.
                 736588      01  --  Here it should update col3 as '01' since for this pno(736588)
                 736588      01  --  Here too it should update col3 as 01 per requirement ,minimum value of this pno in T20
                 736588      01  --     same here too.. Sorry if my post formatting is not good...
    Hope i am clear in my requirement..(update T30 col3 based on min value of col3 of related records)
    Please suggest some update sql for this...(ideas would be great)
    I am using oracle 10 g version soon will be migrated to 11g..
    Regards
    Prasanth
    Edited by: Onenessboy on Oct 20, 2010 12:13 PM
    Edited by: Onenessboy on Oct 20, 2010 12:15 PM

    Onenessboy wrote:
    I am really sorry, my post so nonsense in look..
    I used to use for actuall code..
    the out put i tryped, i used [pre] , [/pre] but still does not look good..
    hmm..thanks for your suggestion hoek..
    so any ideas about my requirement...I would suggest spending a bit more time trying hoek's suggestion regarding {noformat}{noformat} tags instead of repeatedly asking for more help.
    Because to understand your requirement, people are going to have to read it first.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Databinding Problem after Update (SQL Column renaming)

    I updated my JSC yesterday. Since then I cannot bind a datatable column to a renamed SQL Column. Thats very distracting. Is there any configuartion change to do or something else.
    Another thing: Is there any check by the IDE which shows me, which component exists in the pagebean and which in the JSP. I got a lot of error regarding not existing getter and setter in the pagebean.

    Hi Marc,
    Please explain what is the problem you are facing while trying to bind a datatable column to a renamed SQL column. Are you getting any error messages, if so what are they? What are you trying to do exactly? It would be helpful if you can give a detailed step by step procedure to reproduce the problem.
    Every component that exists in the JSP will exist in the page bean too. Please explain what exactly you did to get errors about getter and setter methods. Are you adding components to the JSP source or Pagebean source manually? Again a step by step description for reproducing the problem will enable us to provide answers to your questions.
    Cheers
    Giri

  • SQL Help (Insert and Update)

    I need to use a SQL command like MERGE that is in 9i; however, I am using 8.1.7 which MERGE does not exist. I want to update table "U" with a value if the key columns match with the key columns in table "E". If they do not match, I want to insert a row into table "U". How would the SQL statement be written??

    The short answer is: use 2 SQL statements.
    I've used the 2-statement approach many times. Its funny that I've waited, and waited for the MERGE command for years. Now that its available in 9i, I haven't had an opportunity to use it. However, considering how complicated the "upsert" operation can get, I'd bet that the MERGE command is pretty complicated...
    First off, to save yourself headaches make sure you take care of duplicates in your source table (table E in Douglas' question).
    Now, the 2-SQL's would look something like this:
    update u
    set   (u.col1,
           u.col2) =
               (select e.col1,
                       e.col2
                from   e
                where  e.pk = u.pk)
    where  exists
       (select 1
        from   e e2           /* notice alias e2 used for table e */
        where  e2.pk = u.pk)
    insert into u
        (pk, col1, col2)
      select e.pk,
             e.col1,
             e.col2
      from   e
      where  not exists
        (select 1
         from   u  u2          /* notice alias u2 used for table u */
         where  u2.pk = e.pk)
    --There are many variations on this scheme. One is to have a "status" column in the source table. When there are a small number of updates (or a small number of inserts), you can identify them and set a "status flag". Then take care of the small number of transactions (based on the flag). Now, you can delete the small number of rows and run a much simpler SQL for the majority of the rows.
    Also, you may find it easier to use PL/SQL (as APC was mentioning). However, using the PL/SQL approach gets slower the more rows that are processed. An example might look something like:
    begin
      for c in (select * from e)
      loop
        update u
        set    col1 = c.col1,
               col2 = c.col2
        where  e.pk = c.pk ;
        if sql%rowcount = 0
        then
          insert into u
             (pk, col1, col2)  values (c.pk, c.col1, c.col2) ;
        end if ;
      end loop ;
      commit ;
    end ;
    /Avoid this PL/SQL method if you have more than 10,000 rows. This "looping" approach can be optimized with "bulk-PL/SQL" available in Oracle 8i.
    Typically, this PL/SQL approach is used when major non-SQL calculations must be done during the loading process...
    HTH,
    Stan

  • Sorting a column as a numeric value

    Hello,
           I have created a SQL Report using collections and having problems with sorting one of the column as a numeric value.
    I have used create_collection_from_query2 to assign my numeric value as n001 variable. But, when i use the same in my SQL Report, it is considering the column as string.
    Please advise if i am doing anything incorrect which is causing this issue.
    Thank you in advance,
    Madan

    MadanN wrote:
    An update to my above question:
          I have used to_number() function in the select statement. But, i get an error "Invalid Number" error. I have checked the underlying data and confirmed that the data is a numeric value with a 2 point decimal value.
    Just an FYI., i was using to_number() on  apex_item.display_and_save function.
    A function that clearly returns a VARCHAR2 result:
    APEX_ITEM.DISPLAY_AND_SAVE(
       p_idx IN NUMBER,
       p_value IN VARCHAR2 DEFAULT NULL,
       p_item_id IN VARCHAR2 DEFAULT NULL,
       p_item_label IN VARCHAR2 DEFAULT NULL)
       RETURN VARCHAR2;
    SQL> with t as (
       2        select trunc(dbms_random.value(0, 100)) n from dual connect by level <= 5)
       3  select
       4      n
       5    , apex_item.display_and_save(1, n) d
       6  from
       7      t
       8  order by
       9      n;
              N D
              0 <input type="hidden" name="f01" value="0" /><span>0</span>
              6 <input type="hidden" name="f01" value="6" /><span>6</span>
             27 <input type="hidden" name="f01" value="27" /><span>27</span>
             68 <input type="hidden" name="f01" value="68" /><span>68</span>
             74 <input type="hidden" name="f01" value="74" /><span>68</span>
    Making attempts to convert such results to a number using to_number clearly doomed to failure:
    SQL> with t as (
       2        select trunc(dbms_random.value(0, 100)) n from dual connect by level <= 5)
       3  select
       4      n
       5    , to_number(apex_item.display_and_save(1, n)) d
       6  from
       7      t
       8  order by
       9      n;
       , to_number(apex_item.display_and_save(1, n)) d
    ERROR at line 5:
    ORA-01722: invalid number
    To make the column properly sortable in a SQL report:
    Include the original number column in the query.
    Reference the apex_item.display_and_save column name in the number column's HTML Expression property using column reference syntax (#COLUMN_ALIAS#).
    Make the apex_item.display_and_save column hidden.

  • How to find colums in CLOB variable and get this colums value to update col

    Question
    How to find colums in CLOB variable and get this colums value to update colum of oracle database table
    How my work will go
    Step-1 - I am creating XML FIle which is based on code that we discused before-
    Its developing xml file with data in <...inputelement> as u can see in my xml but in <..output> Element of xml its just have all column for exampe <itemoutput>
    <FLD NM = "ABC"> 0 </FLD>
    <FLD NM = "XYZ:> </FLD> --- for varchar2
    </itemoutput>
    In 1st stage i am just generating <..INPUT> with its colums and real value from database and <..output> elements will go zero value but with colums name.
    Note. I create temp table will all COLUMN which u can see in both in <..ITEMINPUT> and <..ITEMOUTPUT>
    Step2.. After Generaing my xml i want to convert my xml data into CLOB not in a file. so clob will go to the VENDOR
    STEP3.
    I will Recieved again xml data in CLOB from the vendo in <.OUTPUT> ELEMents
    for example
    I send this format
    <itemoutput>
    <FLD NM = "ABC"> 0 </FLD>
    <FLD NM = "XYZ:> </FLD> --- for varchar2
    </itemoutput>
    And i will receive it
    <itemoutput>
    <FLD NM = "ABC VALUE"> 2 </FLD>
    <FLD NM = "XYZ TYPE:> SUV</FLD> --- for varchar2
    </itemoutput>
    So will take this output valu from xml clob and will update my staging table .
    Which have the same colum name as its look in xml clob.
    Step- 4. I will take this value from staging table and update my original oracle database table. which i send you before.
    But u leave this step becaue you dont know the staging table colum maping with original table.
    I think now you understand
    Please feed back
    monriz

    here is my xml..
    I want to extract <..output> elements which enclosed with " " and its values from this xml file. please any body have any idea. please tell me
    Thanks
    <?xml version="1.0" ?>
    - <RATABASECALC COPYRIGHT="COPYRIGHT 2001>
    - <RATEREQUEST USEREFID="YES">
    - <ANCHOR>
    <DATABASENAME />
    <DATABASEPW />
    <DATABASESOURCE />
    <DATABASEPRVDR />
    <USERNAME />
    <SEVERITYDES />
    <CALLDES />
    <INITACCDES />
    <INITACCV />
    <ITEMSEQDES />
    <ITEMMATCHDES />
    <CENTURYDES />
    <DATEDES />
    <FORMULADES />
    <STRINGDES />
    <VALIDATIONDES />
    <STEPSDES />
    <RETINFONUM />
    <ADDLRETINFONUM />
    <ANCHORNOMATCH />
    <NOMATCHMSG />
    <TRANUUID />
    <LOGOPTION />
    <MSGOPTION />
    <USERLOGFN />
    <NOITEMERROR />
    <LOGFORMAT />
    <LOGFN />
    <STEPSFN />
    <NUMNOMATCH>0</NUMNOMATCH>
    <NUMERRORS>0</NUMERRORS>
    </ANCHOR>
    - <POLICIES>
    - <POLICY>
    <BUSINESSDES>N</BUSINESSDES>
    <LEGALENTITYOWNER>CGI TRAINING AND DEMONSTRATION</LEGALENTITYOWNER>
    <LEGALENTITYNAME>CGI TRAINING AND DEMONSTRATION</LEGALENTITYNAME>
    <COMPEFFDATE>02/01/2000</COMPEFFDATE>
    <RETRIEVALDATE>02/01/2000</RETRIEVALDATE>
    <POLINPUTS />
    - <POLOUTPUTS>
    <FLD NM="POLICY CALCS DONE IND">Y</FLD>
    <FLD NM="TOTAL DISCOUNTED POLICY PREM">2167.52</FLD>
    <FLD NM="TOTAL POLICY PREMIUM">3180.0</FLD>
    </POLOUTPUTS>
    - <LOBS>
    - <LOB>
    <LEGALENTITYPRODGROUP>PERSONAL AUTOMOBILE</LEGALENTITYPRODGROUP>
    - <LOBINPUTS>
    <FLD NM="MULTI-CAR FACTOR">0</FLD>
    <FLD NM="MULTI-CAR IND">Y</FLD>
    </LOBINPUTS>
    <LOBOUTPUTS />
    - <REGIONS>
    - <REGION>
    <LEGALENTITYREGION>MAINE</LEGALENTITYREGION>
    - <REGIONINPUTS>
    <FLD NM="STATE PREMIUM AMOUNT">0</FLD>
    </REGIONINPUTS>
    - <REGIONOUTPUTS>
    <FLD NM="TOTAL STATE PREMIUM">2356.0</FLD>
    <FLD NM="TOTAL DISCOUNTED STATE PREM">2167.52</FLD>
    <FLD NM="TOTAL STATE DISCOUNT AMOUNT">188.48</FLD>
    </REGIONOUTPUTS>
    - <REGIONERRORS>
    <NUMLOGENTRIES>3</NUMLOGENTRIES>
    <NUMRETURNLOGENTRIES>0</NUMRETURNLOGENTRIES>
    </REGIONERRORS>
    - <COVERAGES>
    - <COVERAGE RBID="COVP1L1R1C1">
    <COVFORMULAINDEX FORMREF="FMLAP1L1R1F1" />
    <COVINPUTS />
    - <COVOUTPUTS>
    <FLD NM="DEDUCTIBLE BUYBACK">145.0</FLD>
    </COVOUTPUTS>
    <COVCONTROL />
    </COVERAGE>
    - <COVERAGE RBID="COVP1L1R1C2">
    <COVFORMULAINDEX FORMREF="FMLAP1L1R1F2" />
    <COVINPUTS />
    - <COVOUTPUTS>
    <FLD NM="DEDUCTIBLE BUYBACK">209.0</FLD>
    </COVOUTPUTS>
    <COVCONTROL />
    </COVERAGE>
    - <COVERAGE RBID="COVP1L1R1C3">
    <COVFORMULAINDEX FORMREF="FMLAP1L1R1F3" />
    <COVINPUTS />
    <COVOUTPUTS />
    <COVCONTROL />
    </COVERAGE>
    </COVERAGES>
    - <ITEMS>
    - <ITEM>
    - <ITEMINPUTS>
    <FLD NM="COLLISION DEDUCTIBLE">100</FLD>
    <FLD NM="COMP DEDUCTIBLE">FULL</FLD>
    <FLD NM="INEXPERIENCED OPERATOR IND">N</FLD>
    <FLD NM="LIABILITY LIMIT">100</FLD>
    <FLD NM="SYMBOL">15</FLD>
    <FLD NM="TOWING INDICATOR">Y</FLD>
    <FLD NM="INEXPERIENCED OPER FACTOR">0</FLD>
    <FLD NM="VEHICLE SYMBOL">0</FLD>
    <FLD NM="MODEL YEAR">1997</FLD>
    <FLD NM="COST NEW">0</FLD>
    <FLD NM="DRIVER TRAINING INDICATOR">N</FLD>
    <FLD NM="GOOD STUDENT IND">N</FLD>
    <FLD NM="CLASS CODE">11</FLD>
    <FLD NM="COLL RATE">0</FLD>
    <FLD NM="TERRITORY">001</FLD>
    <FLD NM="COMP RATE">0</FLD>
    <FLD NM="PROTECTIVE DEVICE CODE">B</FLD>
    <FLD NM="ANTI LOCK BRAKE IND">Y</FLD>
    <FLD NM="MED RATE">0</FLD>
    <FLD NM="MEDICAL PAYMENTS LIMIT">1000</FLD>
    <FLD NM="PASSIVE RESTRAINT CODE">A</FLD>
    <FLD NM="UNINSURED MOTORISTS LIMIT">100</FLD>
    </ITEMINPUTS>
    - <ITEMOUTPUTS>
    <FLD NM="CLASS FACTOR">0.84</FLD>
    <FLD NM="TOTAL VEHICLE PREMIUM">1166.0</FLD>
    <FLD NM="TOTAL COLLISION PREMIUM">438</FLD>
    <FLD NM="TOTAL COMP PREMIUM">218</FLD>
    <FLD NM="TOTAL LIABILITY PREMIUM">475</FLD>
    <FLD NM="TOTAL MEDICAL PREMIUM">4</FLD>
    <FLD NM="TOTAL TOWING PREMIUM">4</FLD>
    <FLD NM="TOTAL UM PREMIUM">27</FLD>
    </ITEMOUTPUTS>
    - <ITEMNOMATCHES>
    <ITEMNUMNOMATCH>2</ITEMNUMNOMATCH>
    <ITEMRETURNNOMATCH>0</ITEMRETURNNOMATCH>
    </ITEMNOMATCHES>
    - <ITEMCOVINDEXES>
    <ITEMCOVINDEX COVREF="COVP1L1R1C1" />
    </ITEMCOVINDEXES>
    <ITEMCONTROL />
    </ITEM>
    - <ITEM>
    - <ITEMINPUTS>
    <FLD NM="COLLISION DEDUCTIBLE">50</FLD>
    <FLD NM="COMP DEDUCTIBLE">FULL</FLD>
    <FLD NM="INEXPERIENCED OPERATOR IND">N</FLD>
    <FLD NM="LIABILITY LIMIT">100</FLD>
    <FLD NM="SYMBOL">12</FLD>
    <FLD NM="TOWING INDICATOR">N</FLD>
    <FLD NM="INEXPERIENCED OPER FACTOR">0</FLD>
    <FLD NM="VEHICLE SYMBOL">0</FLD>
    <FLD NM="MODEL YEAR">1997</FLD>
    <FLD NM="COST NEW">0</FLD>
    <FLD NM="DRIVER TRAINING INDICATOR">N</FLD>
    <FLD NM="GOOD STUDENT IND">N</FLD>
    <FLD NM="CLASS CODE">12</FLD>
    <FLD NM="COLL RATE">0</FLD>
    <FLD NM="TERRITORY">001</FLD>
    <FLD NM="COMP RATE">0</FLD>
    <FLD NM="PROTECTIVE DEVICE CODE">0</FLD>
    <FLD NM="ANTI LOCK BRAKE IND">Y</FLD>
    <FLD NM="MED RATE">0</FLD>
    <FLD NM="MEDICAL PAYMENTS LIMIT">1000</FLD>
    <FLD NM="PASSIVE RESTRAINT CODE">0</FLD>
    <FLD NM="UNINSURED MOTORISTS LIMIT">100</FLD>
    </ITEMINPUTS>
    - <ITEMOUTPUTS>
    <FLD NM="CLASS FACTOR">0.88</FLD>
    <FLD NM="TOTAL VEHICLE PREMIUM">1190.0</FLD>
    <FLD NM="TOTAL COLLISION PREMIUM">468</FLD>
    <FLD NM="TOTAL COMP PREMIUM">194</FLD>
    <FLD NM="TOTAL LIABILITY PREMIUM">497</FLD>
    <FLD NM="TOTAL MEDICAL PREMIUM">4</FLD>
    <FLD NM="TOTAL TOWING PREMIUM">0</FLD>
    <FLD NM="TOTAL UM PREMIUM">27</FLD>
    </ITEMOUTPUTS>
    - <ITEMNOMATCHES>
    <ITEMNUMNOMATCH>2</ITEMNUMNOMATCH>
    <ITEMRETURNNOMATCH>0</ITEMRETURNNOMATCH>
    </ITEMNOMATCHES>
    - <ITEMCOVINDEXES>
    <ITEMCOVINDEX COVREF="COVP1L1R1C2" />
    </ITEMCOVINDEXES>
    <ITEMCONTROL />
    </ITEM>
    - <ITEM>
    <ITEMINPUTS />
    <ITEMOUTPUTS />
    - <ITEMNOMATCHES>
    <ITEMNUMNOMATCH>2</ITEMNUMNOMATCH>
    <ITEMRETURNNOMATCH>0</ITEMRETURNNOMATCH>
    </ITEMNOMATCHES>
    - <ITEMCOVINDEXES>
    <ITEMCOVINDEX COVREF="COVP1L1R1C3" />
    </ITEMCOVINDEXES>
    <ITEMCONTROL />
    </ITEM>
    </ITEMS>
    - <FORMULAS>
    - <FORMULA RBID="FMLAP1L1R1F1">
    <FORMULANAME>RATING MASTER</FORMULANAME>
    <FORMULARETRIEVALDATE>02/01/2000</FORMULARETRIEVALDATE>
    <FORMULACOMPEFFDATE>02/01/2000</FORMULACOMPEFFDATE>
    <FORMULANEWRENDES>N</FORMULANEWRENDES>
    <FORMULAUSERATEDATE>Y</FORMULAUSERATEDATE>
    <FORMULARATERETRIEVALDATE>02/01/2000</FORMULARATERETRIEVALDATE>
    <FORMULARATECOMPEFFDATE>02/01/2000</FORMULARATECOMPEFFDATE>
    </FORMULA>
    - <FORMULA RBID="FMLAP1L1R1F2">
    <FORMULANAME>RATING MASTER</FORMULANAME>
    <FORMULARETRIEVALDATE>02/01/2000</FORMULARETRIEVALDATE>
    <FORMULACOMPEFFDATE>02/01/2000</FORMULACOMPEFFDATE>
    <FORMULANEWRENDES>N</FORMULANEWRENDES>
    <FORMULAUSERATEDATE>Y</FORMULAUSERATEDATE>
    <FORMULARATERETRIEVALDATE>02/01/2000</FORMULARATERETRIEVALDATE>
    <FORMULARATECOMPEFFDATE>02/01/2000</FORMULARATECOMPEFFDATE>
    </FORMULA>
    - <FORMULA RBID="FMLAP1L1R1F3">
    <FORMULANAME>PREMIUM DISCOUNT</FORMULANAME>
    <FORMULARETRIEVALDATE>02/01/2000</FORMULARETRIEVALDATE>
    <FORMULACOMPEFFDATE>02/01/2000</FORMULACOMPEFFDATE>
    <FORMULANEWRENDES>N</FORMULANEWRENDES>
    <FORMULAUSERATEDATE>Y</FORMULAUSERATEDATE>
    <FORMULARATERETRIEVALDATE>02/01/2000</FORMULARATERETRIEVALDATE>
    <FORMULARATECOMPEFFDATE>02/01/2000</FORMULARATECOMPEFFDATE>
    </FORMULA>
    </FORMULAS>
    <REGIONCONTROL />
    </REGION>
    - <REGION>
    <LEGALENTITYREGION>NEW HAMPSHIRE</LEGALENTITYREGION>
    - <REGIONINPUTS>
    <FLD NM="STATE PREMIUM AMOUNT">0</FLD>
    </REGIONINPUTS>
    - <REGIONOUTPUTS>
    <FLD NM="TOTAL STATE PREMIUM">824.0</FLD>
    <FLD NM="TOTAL DISCOUNTED STATE PREM">0</FLD>
    <FLD NM="TOTAL STATE DISCOUNT AMOUNT">0</FLD>
    </REGIONOUTPUTS>
    - <REGIONERRORS>
    <NUMLOGENTRIES>2</NUMLOGENTRIES>
    <NUMRETURNLOGENTRIES>0</NUMRETURNLOGENTRIES>
    </REGIONERRORS>
    - <COVERAGES>
    - <COVERAGE RBID="COVP1L1R2C1">
    <COVFORMULAINDEX FORMREF="FMLAP1L1R1F4" />
    <COVINPUTS />
    - <COVOUTPUTS>
    <FLD NM="DEDUCTIBLE BUYBACK">0.0</FLD>
    </COVOUTPUTS>
    <COVCONTROL />
    </COVERAGE>
    </COVERAGES>
    - <ITEMS>
    - <ITEM>
    - <ITEMINPUTS>
    <FLD NM="COLLISION DEDUCTIBLE">500</FLD>
    <FLD NM="COMP DEDUCTIBLE">250</FLD>
    <FLD NM="INEXPERIENCED OPERATOR IND">Y</FLD>
    <FLD NM="LIABILITY LIMIT">100</FLD>
    <FLD NM="SYMBOL">11</FLD>
    <FLD NM="INEXPERIENCED OPER FACTOR">0</FLD>
    <FLD NM="VEHICLE SYMBOL">0</FLD>
    <FLD NM="MODEL YEAR">1996</FLD>
    <FLD NM="COST NEW">0</FLD>
    <FLD NM="DRIVER TRAINING INDICATOR">Y</FLD>
    <FLD NM="GOOD STUDENT IND">Y</FLD>
    <FLD NM="CLASS CODE">36</FLD>
    <FLD NM="COLL RATE">0</FLD>
    <FLD NM="TERRITORY">001</FLD>
    <FLD NM="COMP RATE">0</FLD>
    <FLD NM="PROTECTIVE DEVICE CODE">0</FLD>
    <FLD NM="ANTI LOCK BRAKE IND">0</FLD>
    <FLD NM="MED RATE">0</FLD>
    <FLD NM="MEDICAL PAYMENTS LIMIT">1000</FLD>
    <FLD NM="PASSIVE RESTRAINT CODE">0</FLD>
    <FLD NM="UNINSURED MOTORISTS LIMIT">100</FLD>
    </ITEMINPUTS>
    - <ITEMOUTPUTS>
    <FLD NM="CLASS FACTOR">1.11</FLD>
    <FLD NM="TOTAL VEHICLE PREMIUM">824.0</FLD>
    <FLD NM="TOTAL COLLISION PREMIUM">332</FLD>
    <FLD NM="TOTAL COMP PREMIUM">123</FLD>
    <FLD NM="TOTAL LIABILITY PREMIUM">334</FLD>
    <FLD NM="TOTAL MEDICAL PREMIUM">8</FLD>
    <FLD NM="TOTAL UM PREMIUM">27</FLD>
    </ITEMOUTPUTS>
    - <ITEMNOMATCHES>
    <ITEMNUMNOMATCH>2</ITEMNUMNOMATCH>
    <ITEMRETURNNOMATCH>0</ITEMRETURNNOMATCH>
    </ITEMNOMATCHES>
    - <ITEMCOVINDEXES>
    <ITEMCOVINDEX COVREF="COVP1L1R2C1" />
    </ITEMCOVINDEXES>
    <ITEMCONTROL />
    </ITEM>
    </ITEMS>
    - <FORMULAS>
    - <FORMULA RBID="FMLAP1L1R1F4">
    <FORMULANAME>RATING MASTER</FORMULANAME>
    <FORMULARETRIEVALDATE>02/01/2000</FORMULARETRIEVALDATE>
    <FORMULACOMPEFFDATE>02/01/2000</FORMULACOMPEFFDATE>
    <FORMULANEWRENDES>N</FORMULANEWRENDES>
    <FORMULAUSERATEDATE>Y</FORMULAUSERATEDATE>
    <FORMULARATERETRIEVALDATE>02/01/2000</FORMULARATERETRIEVALDATE>
    <FORMULARATECOMPEFFDATE>02/01/2000</FORMULARATECOMPEFFDATE>
    </FORMULA>
    </FORMULAS>
    <REGIONCONTROL />
    </REGION>
    </REGIONS>
    </LOB>
    </LOBS>
    - <RETINFOS>
    <TOTALRI>0</TOTALRI>
    </RETINFOS>
    </POLICY>
    </POLICIES>
    </RATEREQUEST>
    </RATABASECALC>
    Above xml data - some <...OUTPUT> elements has some FLD elements. and i want to take those outputelemt's FLD Elements data and update my oracle tables.
    Note: FLD = "Attribie" are the colums name of the tables
    back to top

  • How to convert pl/sql block into single update statement

    Dear all gurus,
    I have pl/sql block mention below, Can I convert this pl/sql block to single update statement if possible?
    If not how to optimize this block?
    Pleaese suggest.
    thanks in advance.
    Vijay
    DECLARE
    CURSOR vt_mlr_cursor IS Select master_key, user4 from vt_mlr Where USER4 is not null;
    USERFIELD VARCHAR2(100);
    C1 VARCHAR2(3); /* this will return location of first space = 12 */
    C2 VARCHAR2(3); /* this will return location of second space = 20 */
    C3 VARCHAR2(3); /* this will return location of third space = 28 */
    C4 VARCHAR2(3); /* this will return location of forth space = 35 */
    Field1 VARCHAR2(40); /* this will return FTMYFLXA04W */
    Field2 VARCHAR2(10); /* this will return VPI0043 */
    Field3 VARCHAR2(10); /* this will return VCI0184 */
    Field4 VARCHAR2(10); /* this will return 005 */
    Field5 VARCHAR2(10); /* this will return 00001 */
    Field_2_n_3 VARCHAR2(25);
    key VARCHAR2(10);
    BEGIN
    FOR vt_mlr_record IN vt_mlr_cursor
    LOOP
    key := vt_mlr_record.master_key;
    USERFIELD := vt_mlr_record.user4;
    C1 := INSTR(vt_mlr_record.user4,' ',1,1); /* this will return location of first space = 12 */
    C2 := INSTR(vt_mlr_record.user4,' ',1,2); /* this will return location of second space = 20 */
    C3 := INSTR(vt_mlr_record.user4,' ',1,3); /* this will return location of third space = 28 */
    C4 := INSTR(vt_mlr_record.user4,' ',1,4); /* this will return location of forth space = 35 */
    Field1 := SUBSTR(vt_mlr_record.user4,1,C1-1); /* this will return FTMYFLXA04W */
    Field2 := SUBSTR(vt_mlr_record.user4,C1+4,C2-C1-4); /* this will return VPI0043 */
    Field3 := SUBSTR(vt_mlr_record.user4,C2+4,C3-C2-4); /* this will return VCI0184 */
    Field4 := SUBSTR(vt_mlr_record.user4,C3+4,C4-C3-4); /* this will return 005 */
    Field5 := SUBSTR(vt_mlr_record.user4,C4+4,LENGTH(vt_mlr_record.user4)-C4-3); /* this will return 00001 */
    Field_2_n_3 := Field2 || '/' || Field3;
    /*DBMS_OUTPUT.PUT_LINE ('Current key is: ' || vt_mlr_record.master_key);*/
    UPDATE vt_mlr
    SET
    aggregator_clli = Field1,
    aggregator_vpi_vci = Field_2_n_3,
    aggregator_slot = Field4,
    aggregator_port = Field5
    WHERE
    master_key = vt_mlr_record.master_key;
    END LOOP;
    END;
    /

    Hi Vijay,
    Here's something to start with, you should be able to complete it.
    First, combine your select and update statements:
    update vt_mlr
       set aggregator_clli = field1
          ,aggregator_vpi_vci = field_2_n_3
          ,aggregator_slot = field4
          ,aggregator_port = field5
    where user4 is not null;Then put these two
    C1 := INSTR(vt_mlr_record.user4,' ',1,1); 
    Field1 := SUBSTR(vt_mlr_record.user4,1,C1-1);into
    Field1 := SUBSTR(vt_mlr_record.user4,1,INSTR(vt_mlr_record.user4,' ',1,1) -1);And put it into the update statement, removing reference to record
    (I have also removed default values for position and occurrence in instr function):
    update vt_mlr
       set aggregator_clli = substr(user4, 1, instr(user4,' ') - 1)
          ,aggregator_vpi_vci = field_2_n_3
          ,aggregator_slot = field4
          ,aggregator_port = field5
    where user4 is not null; I think you can do the rest from here ;-)
    Regards
    Peter

  • Execute SQL Task does not Update from a Date Variable Reliably

    I'm using a DateTime variable in SSIS 2008 that is used to set the SQLStatement property of an Execute SQL Task.
    "DELETE FROM Labor WHERE Week = '" + (DT_WSTR, 100) @[User::Week] + "'"
    Week is the next Sunday:
    DATEADD( "day", @[User::DaysTillSunday] , @[User::TheDayThatIsTwentyMinutesPrior] )
    DaysTillSunday:
    DATEPART( "dw", @[User::TheDayThatIsTwentyMinutesPrior] ) == 1 ? 0 : 8 - DATEPART( "dw", @[User::TheDayThatIsTwentyMinutesPrior] )
    TheDayThatIsTwentyMinutesPrior:
    (DT_DATE)(DT_DBDATE)DATEADD("minute",-20,GETDATE())
    The SSIS Package deletes the current week's data, reloads it with fresh data, then calculates the difference between the current week and last week.
    The problem is that randomly, instead of deleting the current week, it will delete the previous week.  This happens maybe 5-10% of the time.  At least it does until I rebuild the package and import it into SQL Server again.
    I'm guessing that the Execute SQL Task is not updating the value of the Week variable before it executes.  I started with the source type being a variable.  Then I decided to try Direct input and pass in the Week as a parameter (OLE DB Connection
    Type).  That didn't work either.
    Most recently I tried writing the Week variable to a table first, then having a sequence container with all the tasks second.  Slightly better but I still saw the date was wrong 2 times in about 90 executions.  I was hoping that writing the Week
    variable out to the database would force an update of any associated connections to it, but that didn't seem to work.
    Any ideas?  Is this a known issue, am I missing a setting?
    thanks,
    John

    John, computers either work all the time or have a bug. I suspect it is the latter.
    To find it [faster] you need to log what the resulting expression was used in the package.
    I am baffled how rebuilding a package would fix anything like setting a date.
    It might be even dependant on when you run the package.
    Why
    DATEADD("minute",-20,GETDATE())
    DATEADD( "day", -8 , GETDATE() )
    It must be enough to set the week (that appears to be a date) as above.
    Arthur
    MyBlog
    Twitter

  • SPD 2013 WorkFlow Status Column: Status Not Updated

    We are having an issue with the status display of the SPD Designer Workflow status column which is a read only column added by SharePoint to show the status of the workflow. We have some SharePoint 2013 Workflows built using SharePoint Designer that are
    attached to specific SharePoint Document Libraries. The expected behavior is for this column to show the workflow statuses (Not Started, Starting Workflow, In Progress and Completed. 
    Based on our observation this status is showing up although the column does get added for the Workflow that we have. Is there any other dependency for SPD Workflows that are attached to Document Libraries to show the status correctly? Any other settings/configurations
    to be made?
    Regards,
    Vikram
    Blog: http://dotnetupdate.blogspot.com |

    Hi Venkadesh,
    It is by design that 2013 workflow will show stage name in the workflow status column when
    Automatically update the workflow status to the current stage name is checked.
    And the workflow status column will be blank when Automatically update the workflow status to the current stage name is unchecked.
    For existing workflows, the workflow status will still exists with the previous values after unchecking Automatically update the workflow status to the current stage name.
    We can use Set Workflow Status action to update the workflow status value based on our needs.
    Best regards,
    Victoria
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Checkbox and ORA-20507: Invalid numeric value #:# for column

    Hi All,
    I'm facing problems Checkboxes in a form.
    I created a form and report on a table. one of the fields on the form is a checkbox and when ever I want to create a new record or update with more than one value for the checkkbox I obtain the following error:
    ORA-20507: Invalid numeric value #:# for column COLUMN_NAME Where by #:# is numbers
    I think the error occurs at the processes of get_pk and process_row_of_......
    how should I change the processes to accommodate the checkbox values.
    Kind regards
    Mel

    Hi Roel,
    Colunm = number
    LOV Definition
    select product display, prod_num return from product_category_vw
    where prod_num not in (select p.prod_num from product_user_tb p, user_tb u
    where p.user_num = u.user_number
    and u.user_name = :APP_USER)
    ORDER BY 1column = number
    LOV Definition
    select school d, sch_id r from school_tbRegards
    Mel

  • Searching for numeric values in a text field / SQL Server

    Hi all,
    here's a problem that I've been trying to solve for several days: I try to select rows from an MS SQL Server via JDBC that contain a certain numeric value at a certain position in a long varchar field.
    I'm using queries like
    select * from table where substring(field_1, 37, 7) like '1011234';Those queries always return an empty ResultSet. If I use the same queries in WinSQL, I get correct results (several rows).
    The application code is working in principle; if I search for a text instead of a numeric value, for example select * from table where substring(field_1, 4, 5) like 'Paper'; , I get a complete ResultSet.
    I've tried many variations (= instead of like, search in the entire field (without substring but with like '%1011234%'), with or without ', and more), but that didn't change anything.
    It's also most probably not caused by the JDBC driver; I have tried JTDS first, and then the MS driver (newest versions) - no difference.
    One idea was that the sort order is not correct, tried some COLLATE settings, but that didn't help so far. In this context I'd like to know how to determine the collation sequence of a certain column.
    Another thing I tried was using CAST, for example SELECT * FROM table WHERE CAST(SUBSTRING(field_1, 37, 7) as bigint) = CAST('1011234' as bigint); or SELECT * FROM table WHERE CAST(SUBSTRING(field_1, 37, 7) as bigint) = CAST(1011234 as bigint);, but that didn't help either.
    Some facts:
    Server: Microsoft SQL Server, version 09.00.2047
    Driver in WinSQL: SQLSRV32.DLL, version 03.85.1117
    JDBC-Driver:
    - JTDS, version 1.2
    - Microsoft SQL Server 2005 JDBC Driver, Version 1.2
    JVM: jre1.5.0_11
    I didn't find anything on Google, or in this forum, or other forums. I really hope someone here can help me. Thanks in advance!
    Best regards,
    Uica

    Your note suggests to me that this is a coding problem, not a JDBC or SQL problem unless you are hitting a bug in the SQL Server JDBC driver. Others may have ideas from what you have written, but I think it would be helpful to see the actual code that you are executing that does not bring back the results that you are expecting (don't forgot to use code tags to format your code correctly).
    It might also be helpful to execute a query (from within your Java code) to ensure that you are connecting to the right database, accessing the correct table and that your substring is using the correct offset. The query would look something like this (and then of course display the list of results):
    SELECT substring(field_1, 37, 7) from table

  • Form error Invalid numeric value 06-Jun-13 for column FECHA_CAPTURA

    hi,
    i have an APEX form that updates a table. The form items were created autmatically from the table fields. The 3rd field is a date field and therefore the corresponding date field on the form has a calender icon on its right side. i choose a date from this calender and when i hit the update button i receive this message:
    Invalid numeric value 06-Jun-13 for column FECHA_CAPTURA
    any ideas?

    Hi,
    Could we get you to change 1010319 to a meaningful handle -- I'm Howard.
    In order to give helpful answers, we usually need more information including as much relevant information as possible upfront. This should include:
    Full APEX version
    Full DB/version/edition/host OS
    Web server architecture (EPG, OHS or APEX listener/host OS)
    Browser(s) and version(s) used
    Theme used
    Template(s) used / modified -- (Revelant/important for some problems.)
    Region/item type(s)
    and more detail about what you want to do.
    Are you using ARP (Automatic Row Processing)?
    Do you do any validations?
    Could you make a trival 1-page application on apex.oracle.com duplicating the problem there?
    Howard

  • Script to replace non-numeric value of column to blank

    Hi
    I want to replace non-numeric value of column to blank. Can any one help me out.
    For example:
    column1
    234 kjnkj 12e
    555565asd44
    1232334343
    Now I want to that update cloumn with blank value which contains non-numeric value in it

    Try the following
    select translate(column1,translate(column1,' +-123456789',' '), ' ') b from dual;                                                                                                                                                                                                           

Maybe you are looking for