How to escape & symbol in Update statement

Hi all,
How to escape & symbol in Update statement..
Below is my update statement which contains lot of & symbols...
UPDATE ContentItem SET ContentData =
'&lt:'
where ContentItemId = 398
if i run this query it asks input value for lt..
Can anyone give the suggestions please.. Its very urgent..
Cheers,
Moorthy.GS

Hey all,
Thanks for your reply.
But i am getting error for below statement
set define off;
UPDATE ContentItem SET ContentData =
'<?xml version="1.0" encoding="utf-16"?>
<contentItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="398" resizable="false" contentTypeId="15" parentContentTypeId="0" sortOrder="0" width="0" height="0" xsltFileId="" createDate="0001-01-01T00:00:00" startDate="2006-12-06T00:00:00" endDate="2010-12-31T00:00:00" publishedDate="0001-01-01T00:00:00" CategoryId="0" DotNetClassType="HPCi.OnlineContentDelivery.Core.ContentItem" DotNetAssVersion="1.0.0.0">
<title>Executive_Photos</title>
<CampaignName />
<files />
<textItems>
<textItem type="" linkName="" linkUrl="" identifier="Body" dataDocFileId="">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;contentItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="40" contentTypeId="10" parentContentTypeId="0" sortOrder="0" createDate="0001-01-01T00:00:00" startDate="2006-04-04T00:00:00" endDate="2006-05-06T00:00:00" publishedDate="0001-01-01T00:00:00" DotNetClassType="HPCi.OnlineContentDelivery.Core.ContentItem" DotNetAssVersion="1.0.0.0"&gt;
&lt;title&gt;Image Gallery&lt;/title&gt;
&lt;files /&gt;
&lt;textItems&gt;
&lt;textItem type="" linkName="" linkUrl="" identifier="Body" dataDocFileId="" xsltFileId=""&gt;&lt;!-- BEGIN CODE FOR THE TOP CONTROL --&gt;
&lt;script language="javascript" type="text/javascript"&gt;
function showImage(sImgId, sTargetImgPath)
     document.getElementById("imgLargeImage").src = sTargetImgPath;
&lt;/script&gt;
&lt;div id="topThumbContainer" style="float:left; width:100%;"&gt;
     &lt;div id="divThumbs" style="float:left;"&gt;
          &lt;table&gt;
               &lt;tr&gt;
                    &lt;td width="84px" &gt;
                         &lt;div id="divThumbImage1" class="divThumbImage" onClick="javascript:showImage(''ThumbImg1'', ''Images/bio/BobMetz_lg.jpg'');"&gt;
                              &lt;img id="ThumbImg1" src="Images/bio/BobMetz_sm.jpg" width="63" height="85" /&gt;
                         &lt;/div&gt;
                         &lt;div id="divThumbText1" style="text-align:center;"&gt;Bob Metz&lt;/div&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                         &lt;div id="divThumbImage3" class="divThumbImage" onClick="javascript:showImage(''ThumbImg3'', ''Images/bio/Crawford_lg.jpg'');"&gt;
                              &lt;img id="ThumbImg3" src="Images/bio/Crawford_sm.jpg" width="63" height="85" /&gt;
                         &lt;/div&gt;
                         &lt;div id="divThumbText3" style="text-align:center;"&gt;David Crawford&lt;/div&gt;
                    &lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                    &lt;td width="84px" &gt;
                         &lt;div id="divThumbImage2" class="divThumbImage" onClick="javascript:showImage(''ThumbImg2'', ''Images/bio/JamieGallo_lg.jpg'');"&gt;
                              &lt;img id="ThumbImg2" src="Images/bio/JamieGallo_sm.jpg" width="63" height="85"/&gt;
                         &lt;/div&gt;
                         &lt;div id="divThumbText2" style="text-align:center;"&gt;Jamie Gallo&lt;/div&gt;
                    &lt;/td&gt;
                    &lt;td &gt;
                         &lt;div id="divThumbImage4" class="divThumbImage" onClick="javascript:showImage(''ThumbImg4'', ''Images/bio/Mayfield_lg.jpg'');"&gt;
                              &lt;img id="ThumbImg4" src="Images/bio/Mayfield_sm.jpg" width="63" height="85"/&gt;
                         &lt;/div&gt;
                         &lt;div id="divThumbText4" style="text-align:center;"&gt;Arlene Mayfield&lt;/div&gt;
                    &lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                    &lt;td width="84px" &gt;
                         &lt;div id="divThumbImage5" class="divThumbImage" onClick="javascript:showImage(''ThumbImg5'', ''Images/bio/Turnbull_lg.jpg'');"&gt;
                              &lt;img id="ThumbImg5" src="Images/bio/Turnbull_sm.jpg" width="63" height="85" /&gt;
                         &lt;/div&gt;
                         &lt;div id="divThumbText5" style="text-align:center;"&gt;Robert Turnbull&lt;/div&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                         &lt;div id="divThumbImage6" class="divThumbImage" onClick="javascript:showImage(''ThumbImg6'', ''Images/bio/hessels_lg2.jpg'');"&gt;
                              &lt;img id="ThumbImg6" src="Images/bio/hessels_sm2.jpg" width="63" height="85" /&gt;
                         &lt;/div&gt;
                         &lt;div id="divThumbText6" style="text-align:center;"&gt;Jane T. Hessels&lt;/div&gt;
                    &lt;/td&gt;
               &lt;/tr&gt;
               &lt;tr&gt;
                    &lt;td width="84px" &gt;
                         &lt;div id="divThumbImage7" class="divThumbImage" onClick="javascript:showImage(''ThumbImg7'', ''Images/bio/bauz_lg.jpg'');"&gt;
                              &lt;img id="ThumbImg7" src="Images/bio/bauz_biopic.jpg" width="63" height="85" /&gt;
                         &lt;/div&gt;
                         &lt;div id="divThumbText7" style="text-align:center;"&gt;Melanie Wernick&lt;/div&gt;
                    &lt;/td&gt;
                    &lt;td&gt;
                         &lt;div id="divThumbImage8" class="divThumbImage" onClick="javascript:showImage(''ThumbImg8'', ''Images/bio/child_lg.jpg'');"&gt;
                              &lt;img id="ThumbImg8" src="Images/bio/child_biopic.jpg" width="63" height="85" /&gt;
                         &lt;/div&gt;
                         &lt;div id="divThumbText8" style="text-align:center;"&gt;Mike Child&lt;/div&gt;
                    &lt;/td&gt;
               &lt;/tr&gt;
               &lt;!--&lt;tr&gt;
                    &lt;td&gt;
                         &lt;div id="divThumbsRight"&gt;
                              &lt;img src="Images/AG5_About_Us_Photo_Gallery_Camera.gif" alt="Image of Camera" border="0" height="150" /&gt;
                         &lt;/div&gt;
                    &lt;/td&gt; --&gt;
               &lt;/tr&gt;
          &lt;/table&gt;
     &lt;/div&gt;
&lt;/div&gt;
&lt;!-- END CODE FOR THE TOP CONTROL --&gt;&lt;/textItem&gt;
&lt;textItem type="" linkName="" linkUrl="" identifier="NameTitle" dataDocFileId="" xsltFileId=""&gt;Images&lt;/textItem&gt;
&lt;/textItems&gt;
&lt;/contentItem&gt;</textItem>
</textItems>
</contentItem>'
where ContentItemId = 398
Error is "SQL Error: ORA-01704: string literal too long"
My contentdata column is CLOB datatype.
Pls help me....
Moorthy.GS

Similar Messages

  • How to use escape character in update statement.

    Hi All,
    I'm trying to update table using following sql update statement, but everytime it's asking me for the input due to the '&' value in below sql.
    UPDATE xyz_xyz
       SET NAME = 'ABC & PQR'
    WHERE ID = (SELECT ID
                   FROM abc_abc
                  WHERE NAME = 'C & PQR');Please let me know how to use escape character syntax or let me know if there is any alternative solution.
    Thanks,
    Vishwas

    Hi,
    By default, & marks a substitution variable name.
    If you're not using substitution variables in that statement (or, if this is in PL/SQL, in that entire package or procedure) then the easiest thing to do is just diable substitution variables; then & will be a normal character:
    SELECT  DEFINE  OFF
    UPDATE xyz_xyz
       SET NAME = 'ABC & PQR'
    WHERE ID = (SELECT ID
                   FROM abc_abc
                  WHERE NAME = 'C & PQR');
    SET  DEFINE  ONIf you can't do that, then & is always taken literally if it comes right before a single-quote, so you could say:
    UPDATE xyz_xyz
       SET NAME = 'ABC &' || ' PQR'
    WHERE ID = (SELECT ID
                   FROM abc_abc
                  WHERE NAME = 'C &' || ' PQR');There is a SQL*Plus "SET ESCAPE" command, too, but if you use it, you have to worry about whether the escape character is to be taken literally or not.
    SET   ESCAPE  \Yet another alternative is to make some other character, such as ~, mark the substitution variables:
    SET  DEFINE  ~Read all about them in the SQL*Plus manual.
    http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch2.htm#sthref103

  • Using Escape character in UPDATE statement

    SELECT REPLACE
              ( REPLACE
                     ( REPLACE( REPLACE( REPLACE( REPLACE( BODY, '<STARTOFLINK>' )
                                                , '<ENDOFLINK>' )
      FROM ARTICLEI need to use the above in an UPDATE statement to remove some HTML tags from a CLOB column. However when I run the script it asks for the substitution variables for the '&' characters. I've tried "ESCAPE '\'" but I think you can only use that with a like operand.
    Any suggestions?
    Message was edited by:
    Terrible
    As you can see the HTML tags have been converted in this post!! I'm trying to remove:
    & amp;
    & quot;
    & ndash;
    & #039;

    This may help;
    SQL> create table t (col1 varchar2(200))
    Table created.
    SQL> insert into t values('<STARTOFLINK>')
    PL/SQL executed.
    SQL> insert into t values('<ENDOFLINK>')
    PL/SQL executed.
    SQL> insert into t values(chr(38) || 'amp;')
    PL/SQL executed.
    SQL> insert into t values(chr(38) || 'quot;')
    PL/SQL executed.
    SQL> insert into t values(chr(38) || 'ndash;')
    PL/SQL executed.
    SQL> insert into t values(chr(38) || '#039;')
    PL/SQL executed.
    SQL> insert into t values('<STARTOFLINK>link<ENDOFLINK> '
                       || '  AMP:' || chr(38) || 'amp;'
                       || '  DQT:' || chr(38) || 'quot;'
                       || '  DASH:'|| chr(38) || 'ndash;'
                       || '  SQT:' || chr(38) || '#039;')
    PL/SQL executed.
    SQL> select * from t
    col1                                                                           
    <STARTOFLINK>                                                                  
    <ENDOFLINK>                                                                    
    <STARTOFLINK>link<ENDOFLINK>   AMP:&  DQT:"  DASH:–  SQT:' 
    7 rows selected.
    SQL> select regexp_replace(
              regexp_replace(
                 regexp_replace(
                    regexp_replace(
                       regexp_replace(col1, '<.*OFLINK>',NULL),
                    chr(38) || 'amp;', chr(38)),
                 chr(38) || 'quot;', chr(34)),
              chr(38) || 'ndash;', chr(45)),
           chr(38) || '#039;', chr(39))
    new_col from t
    NEW_COL                                                                        
       AMP:&  DQT:"  DASH:-  SQT:'                                                 
    7 rows selected.Message was edited by:
    MScallion
    The SELECT * values were not as they are displayed due to HTML conversions.

  • How to use Update Statement in ODI Procedure

    Hi,
    How can I use an update statement inside an ODI procedure.
    Thanks

    Hi,
    You do not need the BEGIN and END. ODI procedures are free text, so you can simply write your update statement, as you would in toad/sql developer etc etc. Just make sure you set the Technology and the logical schema. It is how ever best practice to also use the API:
    <%=odiRef.getSchemaName("YOUR_LOGICAL_SCHEMA_NAME", "D")%>. to prefix tables. This way, you select data from different schema's in the same instance (as long a your user has the correct privs).
    Cheers
    Bos
    Edited by: Bos on Jun 22, 2011 3:09 PM

  • Update statement for object table.

    Hi,
    I have created one type as
    Create type test as object(
    ins_by varchar2(30),
    ins_on date,
    upd_by varchar2( 30),
    upd_on date);
    and then created an object table as
    create table imst(
    i_code number(5),
    i_desc varchar2(35),
    i_op test);
    now i am able to insert record in this table as
    insert into imst values(1,'Hawkins cooker',test(user,sysdate,'',''));
    Above works fine.
    But I would also like to update the record with i_op.upd_by,i_op.upd_on with some other values.
    Can any body help me specifying how to write a plain update statement for the same.
    Regards.
    Soumen

    Check it out:
    SQL> Create type myTest as object(
      2  ins_by varchar2(30),
      3  ins_on date,
      4  upd_by varchar2( 30),
      5  upd_on date);
      6  /
    Type created.
    SQL> create table imst(
      2  i_code number(5),
      3  i_desc varchar2(35),
      4  i_op myTest);
    Table created.
    SQL> insert into imst values(1,'Hawkins cooker', mytest(user,sysdate,'',''));
    1 row created.
    SQL> select * from imst;
        I_CODE I_DESC
    I_OP(INS_BY, INS_ON, UPD_BY, UPD_ON)
             1 Hawkins cooker
    MYTEST('APC_LOAD', '12-JUL-04', NULL, NULL)
    SQL> update imst i set i.i_op.upd_by = USER, i.i_op.upd_on = add_months(sysdate, 1);
    1 row updated.
    SQL> select * from imst;
        I_CODE I_DESC
    I_OP(INS_BY, INS_ON, UPD_BY, UPD_ON)
             1 Hawkins cooker
    MYTEST('APC_LOAD', '12-JUL-04', 'APC_LOAD', '12-AUG-04')
    SQL> Smoke me a kipper I'll be back before breakfast.
    Cheers, APC

  • Deciding Column name in UPDATE statement at runtime?

    Hi,
    Assuming there are 5 columns COLUMN1 through COLUMN5 in TABLE1
    In any Update Statement, say:
    UPDATE TABLE1 SET COLUMN1='Hi' WHERE COLUMN2='Hello';
    Can we decide the COLUMN to bet set at runtime depending on some literal value?
    Here in this case, like i get some value in a variable x := 'COLUMN1';, then how can i use an UPDATE statement to following:
    UPDATE TABLE1 SET x='Hi' WHERE COLUMN2='Hello';
    here x is decided on some logic, i.e. which column is to be updated is decided at runtime.
    Please help.
    Many thanks in advance.

    Hi,
    I understood a bit of your code...a 60%..
    Better you can see this below example...small and simple example..from this you can understand....and you can solve your problem.. and use of EXECUTE IMMEDIATE...
    DECLARE
    sql_stmt VARCHAR2(200);
    plsql_block VARCHAR2(500);
    emp_id NUMBER(4) := 7566;
    salary NUMBER(7,2);
    dept_id NUMBER(2) := 50;
    dept_name VARCHAR2(14) := 'PERSONNEL';
    location VARCHAR2(13) := 'DALLAS';
    emp_rec emp%ROWTYPE;
    BEGIN
    EXECUTE IMMEDIATE 'CREATE TABLE bonus (id NUMBER, amt NUMBER)';
    sql_stmt := 'INSERT INTO dept VALUES (:1, :2, :3)';
    EXECUTE IMMEDIATE sql_stmt USING dept_id, dept_name, location;
    sql_stmt := 'SELECT * FROM emp WHERE empno = :id';
    EXECUTE IMMEDIATE sql_stmt INTO emp_rec USING emp_id;
    plsql_block := 'BEGIN emp_pkg.raise_salary(:id, :amt); END;';
    EXECUTE IMMEDIATE plsql_block USING 7788, 500;
    sql_stmt := 'UPDATE emp SET sal = 2000 WHERE empno = :1
    RETURNING sal INTO :2';
    EXECUTE IMMEDIATE sql_stmt USING emp_id RETURNING INTO salary;
    EXECUTE IMMEDIATE 'DELETE FROM dept WHERE deptno = :num'
    USING dept_id;
    EXECUTE IMMEDIATE 'ALTER SESSION SET SQL_TRACE TRUE';
    END;
    Thanks
    Pavan Kumar N

  • Update Statement using SELECT statement

    The following select query return 1 record to me
    [code]
    select  deptno , dname, empno , max_date, max(v_num)
      from (select  d.deptno , d.dname , e.empno ,max (ver_date)  over(partition by d.id ,d.no) max_date  ,v_num
                from  emp e ,dept d
              where  e.deptno=d.deptno and e.dname = d.dname and e.empno=1 and d.deptno =3 )
    group by  deptno , dname, empno , max_date  
    [/code]
    Now I need to update the above value to the emp table itself
    In emp table for the empno=1  I need to update the columns mx_Date and v_num columns with the above last 2 columns in the select statement (max_date, max(v_num) )
    How can I write the update statement for this.
    Thank You

    Something like this
    merge into emp e1
    using (
              select deptno
                   , dname
                   , empno
                   , max_date
                   , max(v_num) v_num
                from (
                       select d.deptno
                            , d.dname
                            , e.empno
                            , max (ver_date)  over(partition by d.id , d.no) max_date 
                            , v_num
                         from emp e
                            , dept d
                        where e.deptno = d.deptno
                          and e.dname  = d.dname
                          and e.empno  = 1
                          and d.deptno = 3
               group
                  by deptno
                   , dname
                   , empno
                   , max_date  
          ) e2
       on (
            e1.empno = e2.empno
    when matched then
        update set e1.mx_date = e2.max_date,
                   e1.v_num   = e2.v_num

  • JDBC and using update statements

    I have a program that connects to a microsoft access DB using JDBC-ODBC Bridge, but i dnt know how to write a correct update statement. I use servlets & it should call a function that retrieves a specific value, adds 1 to that integer value and updates the DB,but it didn't work. i also need to know how to delete all records in a DB.
    Thanks in advance

    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.sql.*;
    public class first_count extends HttpServlet {
       private Statement statement = null;
       private Connection connection = null;
       private String URL = "jdbc:odbc:rjdemo";
       public void init( ServletConfig config )
          throws ServletException
          super.init( config );
          try {
      Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
          connection =DriverManager.getConnection( URL, "", "" );
            }//try
           catch ( Exception e )
             e.printStackTrace();
             connection = null;
          }//catch
       public void doPost( HttpServletRequest req,
                           HttpServletResponse res )
          throws ServletException, IOException
          String cnt;
          cnt = req.getParameter( "big" );
    //takes the parameter of a radio button in a form
         PrintWriter out = res.getWriter();
          res.setContentType( "text/html" );
         if ( cnt.equals("big1"))
    //if the value of the radio button equals big1
             int i=0;
             out.println("The number retrieved = " + big_counter(i));
                      }//if
            out.close();
    int big_counter(int i)
          try {
             i=0;
             statement = connection.createStatement();
             ResultSet r= statement.executeQuery("select beg_count from User");
             r.first();
             i=r.getInt("beg_count");
    //the name of column is beg_count it's a number
             i++;
             statement.executeUpdate("UPDATE User SET beg_count="+i);
             statement.close();
          }//try
          catch ( Exception e )
          }//catch
    return i;
       public void destroy()
          try {
             connection.close();
          catch( Exception e ) {

  • Help with this update statement..

    Hi everyone,
    I am trying to update a column in a table .I need to update that column
    with a function that takes patient_nbr and type_x column values as a parameter.
    That table has almost "300,000" records. It is taking long time to complete
    almost 60 min to 90 min.
    Is it usual to take that much time to update that many records?
    I dont know why it is taking this much time.Please help with this update statement.
    select get_partner_id(SUBSTR(patient_nbr,1,9),type_x) partner_id from test_load;
    (it is just taking 20 - 30 sec)
    I am sure that it is not the problem with my function.
    I tried the following update and merge statements .Please correct me if i am wrong
    in the syntax and give me some suggestions how can i make the update statement fast.
    update test_load set partner_id = get_partner_id(SUBSTR(patient_nbr,1,9),type_x);
    merge into test_load a
    using (select patient_nbr,type_x from test_load) b
    on (a.patient_nbr = b.patient_nbr)
    when matched
    then
    update
    set a.partner_id = get_partner_id(SUBSTR(b.patient_nbr,1,9),b.type_x);
    there is a index on patient_nbr column
    and the statistics are gathered on this table.

    Hi Justin,
    As requested here are the explain plans for my update statements.Please correct if i am doing anything wrong.
    update test_load set partner_id = get_partner_id(SUBSTR(patient_nbr,1,9),type_x);
    "PLAN_TABLE_OUTPUT"
    "Plan hash value: 3793814442"
    "| Id  | Operation          | Name             | Rows  | Bytes | Cost (%CPU)| Time     |"
    "|   0 | UPDATE STATEMENT   |                  |   274K|  4552K|  1488   (1)| 00:00:18 |"
    "|   1 |  UPDATE            |        TEST_LOAD |       |       |            |          |"
    "|   2 |   TABLE ACCESS FULL|        TEST_LOAD |   274K|  4552K|  1488   (1)| 00:00:18 |"
    merge into test_load a
    using (select patient_nbr,type_x from test_load) b
    on (a.patient_nbr = b.patient_nbr)
    when matched
    then
    update
    set a.partner_id = get_partner_id(SUBSTR(b.patient_nbr,1,9),b.type_x);
    "PLAN_TABLE_OUTPUT"
    "Plan hash value: 1188928691"
    "| Id  | Operation            | Name             | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |"
    "|   0 | MERGE STATEMENT      |                  |   274K|  3213K|       |  6660   (1)| 00:01:20 |"
    "|   1 |  MERGE               |        TEST_LOAD |       |       |       |            |          |"
    "|   2 |   VIEW               |                  |       |       |       |            |          |"
    "|*  3 |    HASH JOIN         |                  |   274K|    43M|  7232K|  6660   (1)| 00:01:20 |"
    "|   4 |     TABLE ACCESS FULL|        TEST_LOAD |   274K|  4017K|       |  1482   (1)| 00:00:18 |"
    "|   5 |     TABLE ACCESS FULL|        TEST_LOAD |   274K|    40M|       |  1496   (2)| 00:00:18 |"
    "Predicate Information (identified by operation id):"
    "   3 - access("A"."patient_nbr"="patient_nbr")"Please give some suggestions..
    what's the best approach for doing the updates for huge tables?
    Thanks

  • Update Statement With Date Field

    I'm trying to run an update statement and I want the date to be updated in the format:
    5/4/2010 12:31:54 PM
    If I run this query on dual it displays correctly: select to_char(sysdate,'DD/MM/YYYY HH12:MI:SS PM') from dual
    If I run this query though on my table I get a 'not a valid month' error.
    UPDATE WR_MEASURE_VALUE SET HOST_CORRECTED_VALUE=35,
    HOST_CORRECTED_DATE=to_char(sysdate,'DD/MM/YYYY HH12:MI:SS PM') WHERE WR_MEASURE_VALUE_OID= 474066
    what am I doing wrong and how can I get my update statement to update the date correctly in the 'DD/MM/YYYY HH12:MI:SS PM' form?
    Thanks
    Guess all I needed to say was HOST_CORRECTED_DATE= SYSDATE
    Thanks anyway
    Edited by: Rich75 on May 5, 2010 7:10 AM

    I want the date to be updated in the format: 5/4/2010 12:31:54 PMDate Formats are only of importance when you select/retrieve the dates.
    As you already understand, you can use TO_CHAR for that.
    If HOST_CORRECTED_DATE is of DATE datatype, then you can simply:
    update wr_measure_value
       set host_corrected_value = 35,
           host_corrected_date  = sysdate
    where wr_measure_value_oid = 474066;
    edit
    I see you already found out yourself ;)
    Edited by: hoek on May 5, 2010 4:15 PM

  • Update Statement Assistance

    How would I get this update statement to work in Oracle.
    UPDATE DEPT_BUDGET_TRACK
    SET db.dept_id = d.dept_id
    FROM DEPT_BUDGET_TRACK db JOIN Dept d ON (db.DEPT = d.DEPT_EDW_DESC)
    WHERE d.DEPT_SVC_TYPE in ('SPEC CLIN', 'SPEC CLIN MULTI')
    AND db.MEASURE_TYPE = 'Ambulatory'
    AND db.dept_id is null
    I am using Oracle 11g. Thank you

    Ok....so I get this to work in the example below but I can't get it to work on my data. Would the issue most likely be that I am returning more than 1 dept_id for a specfic dept.
    CREATE TABLE Department
    (DeptName varchar(25),
    Dept_id Number
    INSERT INTO Department
    VALUES ('ACCOUNTING', 100);
    INSERT INTO Department
    VALUES ('IS', 200);
    INSERT INTO Department
    VALUES ('HR', 300);
    CREATE TABLE TEST
    (DeptName varchar(25),
    Dept_id Number
    INSERT INTO TEST(DeptName)
    VALUES ('ACCOUNTING');
    INSERT INTO TEST(DeptName)
    VALUES ('IS');
    INSERT INTO TEST(DeptName)
    VALUES ('HR');
    INSERT INTO TEST(DeptName)
    VALUES ('IS');
    INSERT INTO TEST(DeptName)
    VALUES ('HR');
    UPDATE TEST db
    SET    db.dept_id = ( SELECT d.dept_id
                          FROM   Department d
                          WHERE  db.DeptName = d.DeptName
    WHERE   db.dept_id IS NULL
    AND   EXISTS
          ( SELECT d.dept_id
            FROM   Department d
            WHERE  db.DeptName = d.DeptName
    SELECT * FROM TESTHere is my code again.
    UPDATE dept_budget_track db
    SET    db.dept_id = ( SELECT d.dept_id
                          FROM   dept d
                          WHERE  db.DEPT = d.DEPT_EDW_DESC
                          AND    d.DEPT_SVC_TYPE in ('SPEC CLIN', 'SPEC CLIN MULTI')
    WHERE   db.dept_id IS NULL
    AND   EXISTS
          ( SELECT d.dept_id
            FROM   dept d
            WHERE  db.dept = d.dept_edw_desc
            AND    d.dept_svc_type in ('SPEC CLIN', 'SPEC CLIN MULTI'))Could my issue be that more than 1 dept id is being returned for a specifc dept ?

  • How to call UPDATE statements in the timesten

    Hi i want to know how can i call UPDATE statements from the c program
    as of now i am using SQLPREPARE and SQLEXECUTE for the same.
    but i get the following error.
    Is there any special way of calling UPDATE and INSERT routines.
    As my select statements are doing fine, but i m getting error with UPDATE and INSERT. I am getting the following error
    Can Anyone guide me ?
    ========================================================
    [TimesTen][TimesTen 6.0.4 ODBC Driver][TimesTen]TT5102: Cannot load backend library 'libttorD.a' for Cache Connect. OS error message 'Symbol resolution failed
    for /disk3/users/timesten/TimesTen/TT_EUDEV10G/lib/libttorD.a because:
    Symbol ora_ldap_unbind (number 224) is not exported from dependent
    module /disk1/users/oracle/product/9.2.0/lib/libclntsh.a[shr.o].
    Symbol ora_ldap_memfree (number 225) is not exported from dependent
    module /disk1/users/oracle/product/9.2.0/lib/libclntsh.a[shr.o].
    Symbol
    *** ODBC Error/Warning = S1000, Additional Error/Warning = 5102
    *** (Note: error message was truncated.
    Disconnecting from the data source...
    ==========================================================

    Hi,
    It looks like you are using either :
    1. A READONLY CACHE GROUP with PassThrough > 0.
    or
    2. An SWT CACHE GROUP
    Is that correct? This looks like a mismatch between the TT Oracle library and the version of the Oracle client that you have installed (or maybe a bad setting of LD_LIBRARY_PATH).
    What is the exact version of TimesTen you are using (output of ttVersion command)?
    What is the exact version of Oracle?
    Thanks, Chris

  • How can i use multiple row subquery in update statement

    Hai All
    I using group function in my update statement.. and i need to update more rows so i need to use multiple row
    subquery pls tell me how to use multiple row subquery in update statement
    For example
    while i am using this like this i got an error
    update dail_att set outtime in (select max(r2.ptime) from temp_att where empcode=r2.enpno and
    barcode=r2.cardn and attend_date=r2.pdate group by enpno,pdate,cardn);
    Pls tell me how to use with example
    Thanks & regards
    Srikkanth.M

    Hai Man
    Thanks for ur response Let me clear what i need
    First step Fetch the records as text file and stores into table T1
    and the next step is i have seperated the text using substring and stores in different columns of a table
    There are two shifts 0815 to 1645 and 1200 and 2000
    Here I rep IN and O rep OUT
    Empno date time inout
    001 01-01-10 0815 I
    002 01-01-10 0815 I
    003 01-01-10 0818 I
    001 01-01-10 1100 0
    001 01-01-10 1130 I
    002 01-01-10 1145 0
    002 01-01-10 1215 I
    004 01-01-10 1200 I
    005 01-01-10 1215 I
    004 01-01-10 1315 O
    004 01-01-10 1345 I
    001 01-01-10 1645 0
    002 01-01-10 1715 0
    003 01-01-10 1718 0
    004 01-01-10 2010 0
    005 01-01-10 2015 0
    This is my T1 table i have taken data from text file and stored in this table from this table i need to move data to another table T2
    T2 contains like this
    Empno Intime Intrin Introut Outtime Date
    001 0815 1100 1130 1645 01-01-10
    002 0815 1145 1215 1715 01-01-10
    003 0818 1718 01-01-10
    004 1200 1315 1345 2010 01-01-10
    005 1215 2015 01-01-10
    This what i am trying to do man but i have little bit problems Pls give some solution with good example
    And my coding is
    declare
         emp_code varchar2(25);
    in_time varchar2(25);
    out_time varchar2(25);
    Cursor P1 is
    Select REASON,ECODE,READMODE,EMPD,ENPNO,FILL,PDATE,PTIME,INOUT,CARDN,READERN
    From temp_att
    group by REASON,ECODE,READMODE,EMPD,ENPNO,FILL,PDATE,PTIME,INOUT,CARDN,READERN
    ORDER BY enpno,pdate,ptime;
    begin
         for r2 in p1 loop
    declare
    bar_code varchar2(25);
    begin
    select barcode into bar_code from dail_att where empcode=r2.enpno and attend_date=r2.pdate;
    For r3 in (select empcode,empname,barcode,intime,intrin,introut,addin,addout,outtime,attend_date from dail_att)loop
    if r2.inout ='O' then
    update dail_att set outtime =(select max(r2.ptime) from temp_att where empcode=r2.enpno and barcode=r2.cardn and attend_date=r2.pdate group by r2.cardn,r2.enpno,r2.pdate );
    end if;
    end loop;     
    exception
         when no_data_found then
         if r2.inout ='I' then
                   insert into dail_att(barcode,empcode,intime,attend_date)(select r2.cardn,r2.enpno,min(r2.ptime),r2.pdate from temp_att group by r2.cardn,r2.enpno,r2.pdate );
         end if;
    end;
    end loop;
    commit;     
         end;
    Pls tell me what correction i need to do i the update statement i have used a subquery with group function but when i used it will return only one row but my need is to return many rows and i need to use multiple row subquery
    and how can i use it in the update statement
    Thanks In Advance
    Srikkanth.M

  • How to use the updated value in the same update statement

    Hello,
    I just wonder how to use the updated new value of other column in the same udpate statement. I am using Oracle 11.2, and want to update the two columns with one update statement as following:
    create table tb_test (id number(5), tot number(5), mon_tot number(5));
    update tb_test set (tot = 15, mon_tot = tot *15) where id = 1;
    ...I would like to update both tot and mon_tot column, the value of mon_tot shall be determinted by the new value of tot.
    Thanks,
    Edited by: 939569 on 1-Feb-2013 7:00 AM

    Edit: example added
    SQL> create table tb_test
      2  ( id number(5)
      3  , tot number(5)
      4  , mon_tot number generated always as (tot*15) virtual
      5  );
    Table created.
    SQL> insert into tb_test (id, tot) values (1, 5);
    1 row created.
    SQL> select * from tb_test;
            ID        TOT    MON_TOT
             1          5         75
    1 row selected.
    SQL> update tb_test
      2  set    tot = 15
      3  where  id = 1;
    1 row updated.
    SQL> select * from tb_test;
            ID        TOT    MON_TOT
             1         15        225
    1 row selected.

  • I had my iphone 4 locked to vodafone uk carrier. I connected the phone to itunes on my pc and tried to update the version to ios 6 through itunes. But it has been locked and asks for sim of previous carrier. how can i return to previous state?

    I had my iphone 4 locked to vodafone uk carrier. I connected the phone to itunes on my pc and tried to update the version to ios 6 through itunes. But it has been locked and asks for sim of previous carrier. how can i return to previous state?

    You cannot return to previous state. The update re-locked the iPhone
    to the original carrier. You must contact the original carrier to see if
    they offer unlocking and if you qualify.
    What does it say when you look at Settings=>General=>Carrier?
    Be advised that if your iPhone had previously been hacked/modified/
    jailbroken to work with other than original carrier, it may be impossible
    for the original carrier to unlock it properly.

Maybe you are looking for

  • SQL Server and Oracle

    is there a SQL server tool or database utility that allows to automatically synchronize data between a table in SQL server and a table(same structure) residing in Oracle on a different server... Ashish

  • Where is the image attachment resize function in Mail?

    I have not been able to find an answer to where the resize function in Mail on SnowLeopard has gone in MountainLion. Which I just updated to, skipping Lion. thank you for your time.

  • Save ALV Reporrt

    Hi i need to save ALV layout in  grid display. wat to do. Regards Rasheed

  • Lenovo N100 takes 25 minutes to go through Bios splashscreen

    hi all, i am new here and i have a problem with my N100 notebook, when i turn it on it does not show anything but black screen, if i leave it 5 to 7 minutes it will show the lenovo Bios screen and stay there for about 15 minutes then it starts loadin

  • New computer/software???

    Hopefully you can help me. I bought my ZEN MP3 player from BEST BUY in Henderson, NV. In 2007 or 2008. I cannot remember exactly and I cannot find my paperwork, receipts. I am 64 yrs old and am getting very forgetful. I cannot find software either. I