Insert Calculated data in Table column
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Insert Calculated data in Table column

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    1

    Smile Insert Calculated data in Table column

    Hi,

    I have a table in which there are 10 columns, i want to write a SP which will insert the data in the first and the 4 column of the table.

    The 4th column is a numeric column and want to insert calculated date in that. the calculation is bleow.

    "case when PROPOSAL.CHANGEORDER = 0 then nvl(UNIT.PRI_ACTUALUNITPLPRICE,0)
    when PROPOSAL.CHANGEORDER = 1 and PROPOSAL.CHANGEORDERTYPE <> 2 then nvl(UNIT.PRI_ACTUALUNITPLPRICE,0)
    when PROPOSAL.CHANGEORDER = 1 and PROPOSAL.CHANGEORDERTYPE = 2 AND SOLUTION.ISCANCELLEDGROUP = 0 then nvl(UNIT.PRI_ACTUALUNITPLPRICE,0)
    when PROPOSAL.CHANGEORDER = 1 and PROPOSAL.CHANGEORDERTYPE = 2 AND SOLUTION.ISCANCELLEDGROUP = 1 then nvl(UNIT.PRI_ACTUALUNITPLPRICE,0)
    else 0 end"

  2. #2
    Join Date
    Apr 2001
    Location
    Czechia
    Posts
    712
    It's OK, just use the expression as a column value.
    Ales
    The whole difference between a little boy and an adult man is the price of toys

  3. #3
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,554
    Quote Originally Posted by deepak_vkdk View Post
    I have a table in which there are 10 columns, i want to write a SP which will insert the data in the first and the 4 column of the table.

    What are you planning to do with the other eight columns?

    Are you actually "inserting" or you meant "updating" on the affected table?
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width