SQL*Plus - Update field in a table using a variable

Posted on 2009-02-18
Last Modified: 2013-12-07

Database Name: ess_test
Tablename: data_to_ess
Field that needs updated: status
Field that holds variable:  contract
Variable Name:  convar

Need a sample stored procedure or SQL*Plus command that would do the following:

Find all records where 'convar' equals 'C43' and 'status' equals 'Move_To_Planning'.  For all those records change the value in the 'status' field from 'Move_To_Planning' to 'Completed'.  Do nothing 'contract' field.  Can use sample login username and password for this example.

Is this enough information?


Question by:elwayisgod
    1 Comment
    LVL 32

    Accepted Solution

    Just an UPDATE statement?  how's this?

    Update data_to_ess Set Status =  'Completed'
    Where Status = 'Move_To_Planning'
         And convar = 'C43';

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
    I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
    This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
    This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now