How to update one table from another

I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
I created a table with the following sql of all the affected rows:
CREATE TABLE LSU_INTER_FIX_DATE AS
select request_id,received_date,planned_start_date, actual_start_date
from lsu_inter2_requests_t
where received_date < to_date('01-JAN-1900')
OR planned_start_date < to_date('01-JAN-1900')
OR actual_start_date < to_date('01-JAN-1900')
I then repaired all of the rows with three data fixes
UPDATE LSU_INTER_FIX_DATE
SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
where received_date < to_date('01-JAN-1900')
UPDATE LSU_INTER_FIX_DATE
SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
where planned_start_date < to_date('01-JAN-1900')
UPDATE LSU_INTER_FIX_DATE
SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
where actual_start_date < to_date('01-JAN-1900')
I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
UPDATE lsu_inter2_requests_t aaa
SET aaa.received_date = bbb.received_date
FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?

Comet wrote:
I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
I created a table with the following sql of all the affected rows:
CREATE TABLE LSU_INTER_FIX_DATE AS
select request_id,received_date,planned_start_date, actual_start_date
from lsu_inter2_requests_t
where received_date < to_date('01-JAN-1900')
OR planned_start_date < to_date('01-JAN-1900')
OR actual_start_date < to_date('01-JAN-1900')
I then repaired all of the rows with three data fixes
UPDATE LSU_INTER_FIX_DATE
SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
where received_date < to_date('01-JAN-1900')
UPDATE LSU_INTER_FIX_DATE
SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
where planned_start_date < to_date('01-JAN-1900')
UPDATE LSU_INTER_FIX_DATE
SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
where actual_start_date < to_date('01-JAN-1900')
I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
UPDATE lsu_inter2_requests_t aaa
SET aaa.received_date = bbb.received_date
FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?I am not convinced you have what you think you have
>
UPDATE LSU_INTER_FIX_DATE
SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
where received_date < to_date('01-JAN-1900')
When you want to produce a DATE datatype when starting with a string,
you must use TO_DATE() on the SET line!
(TO_CHAR(received_date,'RRRR') + 2000)since when do you do add characters (from TO_CHAR) with a constant number (2000)?
You should NEVER EVER rely on implicit datatype conversion
Edited by: sb92075 on Jul 27, 2011 7:09 PM

Similar Messages

  • How to update one table from another table?

    Hi,
    Please go through the case I am mentioning below and if possible try to provide with a solution.
    I am working on a report to generate cash flow forecast, where in one of the fields is "Payroll", in which its being mentioned as:
    In the selection screen: I am entering Project ID, profit Center and Period(in MM/YYYY format).
    Selection of all entries in table COSP for selected cost elements above, value type 1, version , all periods and for all selected WBS elements and all objects underneath.
    From this, update table COFP with information from COSP with value type 62 and same period.
    For updation of various fields the following information is being given.
    How should we update COFP?
    New entries per OBJNR/PERIO and HKONT are required via using the information from COSP:
    COFP-MANDT              =          SY-MANDT
    COFP-KOKRS              =          if COSP-OBJNR begins with ‘PR’
                                                   Check table PRPS with COSP-OBJNR = PRPS-OBJNR and enter PRPS-PKOKR
                                                    If COSP-OBJNR begins with ‘NV’
                                                   Check table AFVC with COSP-OBJNR = AFVC-OBJNR,
    go to Table AFKO with AFVC-AUFPL,
    go to table AUFK with AFKO-AUFNR and enter AUFK-KOKRS
    If COSP-OBJNR begins with ‘OR’
    Check table AUFK with COSP-OBJNR = AUFK-OBJNR
    and enter AUFK-KOKRS
    COFP-BELNR               =          Check table NRIV, CLIENT = SY-MANDT, OBJECT = RK_BELEG,
    SUBOBJECT = COFP-KOKRS, NRRANGENR = ‘05’,
    Add 1 to NRLEVEL and begin with 500000000
    Use same BELNR for one update-run
    COFP-BUZEI                =          ‘1’ + and 1 in next entry but same update-run
    COFP-TWAER              =          COSP-TWAER
    COFP-ZHLDT                =          always last day of month in field COFP-PERIO
    COFP-GJAHR               =          COSP-GJAHR
    COFP-PERIO               =          if entry in field WKG001 à PERIO = 001
                                                   If entry in field WKG006 à PERIO = 006……
    COFP-WRTTP              =          ‘62’
    COFP-VRGNG              =          ‘FIPL’
    COFP-POSIT                =          Check table SKB1 where SAKNR = COSP-KSTAR and use SKB1-FIPOS
                                                   for going to table FMCI-FIPOS and enter FMCI-POSIT
    COFP-OBJNR               =          COSP-OBJNR
    COFP-HKONT              =          COSP-KSTAR
    COFP-WKGBTR           =          WKGXXX
    COFP-WKGBTRO         =          -
    COFP-WTGBTR            =          WTGXXX
    COFP-WTGBTRO         =          -
    COFP-WOGBTR           =          WTGXXX
    COFP-WOGBTRO        =          -
    COFP-BUKRS1            =          -
    COFP-GJAHR1             =          -
    COFP-BELNR1             =          -
    COFP-BUZEI1              =          -
    COFP-BUKRS2            =          -
    COFP-GJAHR2             =          -
    COFP-BELNR2             =          -
    COFP-BUZEI2              =          -
    COFP-EBELN               =          -
    COFP-EBELP               =          -
    COFP-ZEKKN               =          -
    COFP-ETENRM            =          -
    COFP-STUNR               =          -
    COFP-LIFNR                =          -
    COFP-KUNNR              =          -
    COFP-GSBER              =          -
    COFP-BUKRS              =          (nearly same as COFP-KOKRS!)
                                                   if COSP-OBJNR begins with ‘PR’
                                                   Check table PRPS with COSP-OBJNR = PRPS-OBJNR and enter PRPS-PBUKR
                                                    If COSP-OBJNR begins with ‘NV’
                                                   Check table AFVC with COSP-OBJNR = AFVC-OBJNR,
    go to Table AFKO with AFVC-AUFPL,
    go to table AUFK with AFKO-AUFNR and enter AUFK-BUKRS
    If COSP-OBJNR begins with ‘OR’
    Check table AUFK with COSP-OBJNR = AUFK-OBJNR
    and enter AUFK-BUKRS
    COFP-EINDT                =          -
    COFP-SGTXT               =          -
    COFP-GEBER              =          -
    COFP-KURSF              =          -
    COFP-KUFIX                =          -
    COFP-GBETR              =          -
    COFP-KURSR              =          -
    COFP-KURSFIKRS       =          -
    COFP-KZKRS               =          -
    COFP-UMBKZ              =          -
    COFP-KBLNR               =          -
    COFP-KBLPOS            =          -
    COFP-HI FIVOR            =          -
    COFP-LO FIVOR          =          -
    COFP-HI ACCOUNT      =          -
    COFP-LO ACCOUNT     =          -
    COFP-HI LIFNR            =          -
    COFP-LO LIFNR           =          -
    COFP-HI KUNNR          =          -
    COFP-LO KUNNR         =          -
    COFP-XDELETE           =          -
    COFP-HI XOPVW         =          -
    COFP-LO XOPVW        =          -
    COFP-ZAEHK               =          -
    COFP-CHAINBELNR     =          -
    COFP-MWSKZ             =          -
    COFP-LEDNR               =          -
    COFP-BELTP               =          ‘1’
    COFP-VERSN              =          ‘0’
    COFP-OWAER             =          COSP-TWAER
    COFP-CPUDT               =          SY-DATUM
    COFP-CPUTM              =          SY-TIME
    after doing updation, its again saying Selection of all entries in table COFP with value type 51 to 62, selected year, selected cost elements above and for all selected WBS elements and all objects underneath. Summarisation by period.
    Now, can someone help me as how to proceed with the entire thing? An elaborate and illustrative answer would be highly appreciable.
    If you require any other information....then get back to me ..asap.
    Its bit urgent.
    Thanks & Regards,
    Ravi

    Hi
    update <table> from <i_tab>
    for different conditions.
    loop at i_cosp.
    if cosp-mandt eq sy-mandt and  cosp-objnr eq 'PR'.
    Read table i_PRPS with key  i_PRPS-OBJNR = i_COSP-OBJNR.
    if sy-subrc eq 0.
    update PRPS set PKOKR = ? where objnr = i_prpr-objnr.
    endif.
    endif.
    similarly for all the conditions
    Regards
    Message was edited by: Harikishore Sreenivasulu

  • How to refer one view from another view?

    Hi,
    I have 2 views in my Adobe Flash Builder mobile app. I need to refer the first view in my second view.
    How to refer one view from another view? Or how to create a reference to a view wherever needed?

    I don't need any data from my first view. In a certain flow, I need to make my first view to be invisible.
    for eg., My First view is in portrait mode. I change the device to Landscape. In the landscape mode, I want to show a completely different view (second view).
    In this case, what happens is, I see my first view in Landscape mode for a second. Then the second view appears. When I change to Landscape mode, only the second view should be seen. I need to make my first view to be completely invisible in the OnOrientationChanging event of
    StageOrientationEvent
    As stage object and StageOrientationEvent works at application level, I need to know how to refer my first view object in the application level.
    private function onOrientationChanging(soe:StageOrientationEvent):void
          MyFirstView.Visible = False; ====> don't know how to refer MyFirstView here
    Is my question clear now?

  • How to import a table from another oracle database ?

    Hi all ,
    i could like to use pl/sql to import one table from another oracle database server ?
    is it possible to do this ?
    A server B server
    table: test <------------------------> table : newtest
    the tns profile already configurated . the connection is ready .
    thanks a lot !
    Best Regards,
    Carlos

    if i don't have TEST table on server B whether COPY command will create this table on server B with the same structure ? If you specify CREATE as a clause the table will be created:
    SQL> help copy
    COPY
    COPY copies data from a query to a table in a local or remote
    database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
    COPY {FROM database | TO database | FROM database TO database}
                APPENDCREATE|INSERT|REPLACE} destination_table
                [(column, column, column, ...)] USING query
    where database has the following syntax:
         username[password]@connect_identifier

  • How to restore one table from the previous backup in 9.2.0.8 version.

    Hi,
    How to restore one table from the previous backup in 9.2.0.8 version.
    Thanks
    -Ganga

    Hi,
    What is the table you want to restore?
    Using export/import is supported with Oracle Apps database (for full database exp/imp, and certain schemas like custom ones). For the Apps schema, I believe it is not supported due to object dependencies and integrity constraints.
    Regards,
    Hussein

  • Update column in one table from another

    I've got two tables:
    t1:
    con_num
    con_code
    ex
    elin
    addressee
    a few other columns
    t2:
    con_num
    con_code
    elin
    addressee
    contact
    a few other columns
    I just got about 300 rows into t2 using sqlloader, and now I need to use t2 to update t1. t1 will have 3 rows per ex||elin, but t2 can have more or less rows per elin (which is the same as ex||elin in t1). If t2 has 4 rows per one elin, then that is 4 distinct pieces of data, and I need to make sure that t1 reflects 4 rows in its ex||elin, each containing the addressee||contact from t2. So I'll need to add a row to t1, as well as update 3 rows. Is this possible with just SQL, or do I need to write PL/SQL?
    The following is the code I've been trying:
    update t1
    set t1.addressee =
    (select addressee from t2
    where t2.con_num = 'number'
    and t1.con_code = t2.con_code
    and t1.ex ||t1.elin_num = t2.elin_num)
    This code is not correct, it returns more than one row from t2. Also, I'd need to concatenate contact onto addressee with a space in the middle, not just addressee, into t1.addressee.
    Any ideas, pointers?
    Thanks!

    Forgot some info: Ora8.1.5 on win2kpro. Also, I was wanting to combine addressee||contact in the insert/update statement to differentiate one addressee from another in t1 after the data is inserted. We can have several addressees that are the same, but each one goes to a different contact for each record.
    Thanks!

  • How to update one table based on another table ??

    Hello Friends:
    I am trying to run the following query in oracle but it won't run.
    UPDATE BOYS
    SET
    BOYS.AGE = GIRLS.AGE
    FROM GIRLS
    WHERE
    BOYS.FIRSTNAME = GIRLS.FIRSTNAME AND
    BOYS.LASTNAME = GIRLS.LASTNAME;
    This query runs fine in sql server but in oracle its saying can't find "SET". PLease tell me what is the correct syntax in oracle to update one table based on another table.
    thanks

    See if this helps.
    If you wrote an SQL statement:
    update boys set age = 10;
    Every row in the boys table will get updated with an age of 10. But if you wrote:
    update boys set age = 10
    where firstname = 'Joe';
    Then only the rows where the firstname is Joe would be updated with an age of 10.
    Now replace the 10 in the above statements with (select g.age from girls g where g.firstname = b.firstname and g.lastname = b.lastname) and replace where firstname = 'Joe' in the second statement with where exists (select null from girls g where g.firstname = b.firstname and g.lastname = b.lastname). The same concepts apply whether 10 is an actual value or a query and whether you have a where clause with the update statement to limit rows being updated.
    About the select null question regarding the outer where clause:
    Since the query is checking to see if the row in the girls table exists in the boys table what the column is in this select statement doesn't matter, this column isn't being used anywhere. In this case Todd chose to use null. He could have also used a column name from the table or a lot of times you'll see the literal value 1 used here.

  • How to call one program from another program

    Hai,
      How to call one program through another program.
    Example.
       I have two programs 1.ZPROG1 2. ZPROG2.
    When i execute ZPROG1 at that time it should call ZPROG2.

    Hi ,
    u can use submit statement to call a program .
    DATA: text       TYPE c LENGTH 10,
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
          range_tab  LIKE RANGE OF text,
          range_line LIKE LINE OF range_tab.
    rspar_line-selname = 'SELCRIT1'.
    rspar_line-kind    = 'S'.
    rspar_line-sign    = 'I'.
    rspar_line-option  = 'EQ'.
    rspar_line-low     = 'ABAP'.
    APPEND rspar_line TO rspar_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'H'.
    APPEND range_line TO range_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'K'.
    APPEND range_line TO range_tab.
    SUBMIT report1 USING SELECTION-SCREEN '1100'
                   WITH SELECTION-TABLE rspar_tab
                   WITH selcrit2 BETWEEN 'H' AND 'K'
                   WITH selcrit2 IN range_tab
                   AND RETURN.
    regards,
    Santosh thorat

  • How to call one .SWF from another?

    How do I call one .SWF from another. I built a very beefy
    base .SWF, and want to add music overlay, and an intro slide show
    to the exsting Flash animation, but put it in a second .FLA/.SWF
    file. How do I call one from the other?
    This will be embedded in an HTML file but I assume this is
    superfluous to my question.
    F.Z.

    I think you should open that Another SWF (FLA),
    and add some actionscript..
    For example, you could create a movie clip, and write
    actionscript in the
    first keyframe:
    loadMovie("
    http://www.somewebpage.com/movie.swf",
    this);
    "FredZimmerman" <[email protected]> wrote in
    message
    news:ftnjas$mj5$[email protected]..
    > How do I call one .SWF from another. I built a very
    beefy base .SWF, and
    > want
    > to add music overlay, and an intro slide show to the
    exsting Flash
    > animation,
    > but put it in a second .FLA/.SWF file. How do I call one
    from the other?
    >
    > This will be embedded in an HTML file but I assume this
    is superfluous to
    > my
    > question.
    >
    > F.Z.
    >

  • How to kill one class from another class

    I need to dipose one class from another class.
    So that first i have to find what are all threads running in that class and then to kill them
    Assist me.

    Subbu_Srinivasan wrote:
    I am explaining you in clear way
    No you haven't been.
    >
    In my application i am handling many JInternalFrame.Simultaneously i am running working on more than one frame.
    Due to some poor performance of some thread in one JInternalFrame,the thread is keeps on running .
    i could not able to proceed further on that screen.
    So i have to kill that JInternalFrame.Yoinks.
    To be begin with your problem sounds like you are doing everything in one thread. So stop doing that. Second when you get it split up and if a task is taking too much time then interrupt it. No kill. Interrupt. This means the worker thread needs to check sometimes if it has been interrupted.

  • How to Call one EJB from another

    Hi all
    I am trying to call one EJB in one system from another EJB residing on diferent system...
    Both are Stateless session beans ...
    I can't use No-args Intialcontext() as i need to specify the Ip address of other system to be looked up.....
    So i am using properties Dorg.omg.CORBA.ORBInitlalHost....
    But its not looking up..Its telling not bound...But i called it from standalone client remotely...
    Am i wrong..?
    I hope I am in right path....
    I hope ill get reply as fast as possible...
    Gopal V

    Hi ken Thanks for replying....
    Ya i packed it as a jar (using Export tool in Eclipse3.2)....
    I am using SUN AS 9.....
    I packed bean1 and bean2 as two different jars in the same domain...
    Here is my code...
    Bean1:
    @Stateless(mappedName="ejb/Second")
    public class SecondIMPL implements SecondRemote {
         public FirstRemote obj;
         public String connect() {
              try{
                   InitialContext ctx= new InitialContext();
                   FirstRemote obj =(FirstRemote)ctx.lookup("ejb/First");
                   System.out.println("Client :"+obj.bMethod());
              }catch(Exception e){
                   e.printStackTrace();
              return "Check server Log";
    }Bean2 :
    @Stateless(mappedName="ejb/First")
    public class FirstIMPL implements FirstRemote {
         public String bMethod() {
              return "From First Bean";
    Client:
    public static void main(String[] args) {
              try{
                   InitialContext ctx= new InitialContext();
                   SecondRemote obj =(SecondRemote)ctx.lookup("ejb/Second");
                   System.out.println("Client :"+obj.connect());
              }catch(Exception e){
                   e.printStackTrace();
    Here is my Stack Trace...
    [#|2007-05-24T18:35:17.214+0530|WARNING|sun-appserver-pe9.0|javax.enterprise.system.stream.err|_ThreadID=18;_ThreadName=p: thread-pool-1; w: 19;_RequestID=bb4848e7-829a-421d-a560-93659898eb02;|
    javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.SecondRemote[Root exception is java.lang.ClassNotFoundException: com.SecondRemote]
         at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:350)
         at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:61)
         at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
         at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:314)
         at javax.naming.InitialContext.lookup(InitialContext.java:351)
         at com.FirstBean.rediff(FirstBean.java:16)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1050)
         at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:165)
         at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2766)
         at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3847)
         at com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:190)
         at com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:110)
         at $Proxy36.rediff(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:121)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:650)
         at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:193)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1705)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1565)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:947)
         at com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:178)
         at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:717)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.dispatch(SocketOrChannelConnectionImpl.java:473)
         at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.doWork(SocketOrChannelConnectionImpl.java:1270)
         at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:479)
    Caused by: java.lang.ClassNotFoundException: com.Second
         at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader.java:701)
         at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.java:614)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
         at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:568)
         at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:320)
         ... 31 more
    |#]

  • SQL update one column from another column

    I'm looking for a way to update a SQL column with a portion
    of info from another column in the same table.
    example of a sql command
    UPDATE table1
    SET table1.columnname1 = table1.columnname2
    FROM table
    WHERE blah blah blah
    Here's the thing... I only need a portion of the data found
    in the source column. I'm not sure how I would do this then.
    for example, the database has countries and states combined
    into one column like this 'US-DC', 'US-CA', US-FL', etc. I want to
    separate these into two columns, a country column and a state
    column.... and I dont want to go though all the results and do this
    line by line. How would I write the SQL command so that it puts
    just the country in the country column, and puts just the state in
    the state column, and it omits the dash all together.
    any ideas?

    It depends. Are you using PHP and mySQL or ASP and SQL?
    If you are using mysql and PHP you could use the following
    code to loop through all records in your datatbase.
    $sql="SELECT * FROM tablename"; //SET tablename to the name
    of your database table.
    $result=mysql_query($sql)or die(mysql_error(). " - $sql");
    for($x = 0; $row=mysql_fetch_assoc($result); $x++){
    //set up the variables from the table
    $ID=$row['ID']; //this is the primary key
    $var1=$row['contrystatecolumn']; //this is the name of the
    column which holds the country-state
    $var2=explode("-", $var1); //now we explode the string to get
    the country and the state seperated and place the results into an
    array
    $country=$var2[0]; //this is the first piece of the exploded
    string in the array
    $state=$var2[1]; //this is the second piece of the exploded
    string in the array
    //now we update the database record with the new information
    //remember to replace the tablename with your actual table
    name and the columns country and state with the acutal names of
    your columns in your table
    $sql2="UPDATE tablename SET country='$country'.
    state='$state' WHERE ID='$ID'";
    $result2=mysql_query($sql2)or die(mysql_error() . " -
    $sql2");
    This code will loop through every record in your table and do
    what you want very quickly.
    Hope this helps
    Stan Forrest
    Senior Web Developer
    ATG Internet

  • How to import a table from another database using DB toolset.

    Hello All
    I would like to import a table from one database to another using DB toolbox.
    I do not want to import all data to LV and then save them to another database. Instead I would prefer to use SQL syntax.
    Does anobody know how to write SQL command to import whole table from one database to another?
    I have found in some SQL manual that INSERT INTO should work, but JET4 returns an error that table (e.g. c:\mydatabase\table1) can not be found.
    Thanks in advance
    Pawel

    if i don't have TEST table on server B whether COPY command will create this table on server B with the same structure ? If you specify CREATE as a clause the table will be created:
    SQL> help copy
    COPY
    COPY copies data from a query to a table in a local or remote
    database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
    COPY {FROM database | TO database | FROM database TO database}
                APPENDCREATE|INSERT|REPLACE} destination_table
                [(column, column, column, ...)] USING query
    where database has the following syntax:
         username[password]@connect_identifier

  • How modify data one view from another view in Cluster view

    Hi,
    I have a cluster view which includes two independent maintenance views. These views have not a direct relationship.
    If I would append or change or delete records in the first view I want to add or change or delete some records in the second view.
    1.
    I have tried to use Extended Table Maintenance Events of the first view to modify the second but I cant access to the TOTAL and EXTRACT tables the second view from the fist view.
    Is there any way to get access from one view to another using Extended Table Maintenance Events?
    2.
    I have tried to use the Event 04/VC: Before Saving the Data in the Database of the cluster view. I can access and modify the second view internal table using routines
    READ TABLE vcl_struc_tab WITH KEY object = 'ZFIRST_VIEW' INTO structab_wa.
    if  not structab_wa-UPD_REQU is initial.
       perform VCL_SET_TABLE_ACCESS_FOR_OBJ using 'ZSECOND_VIEW' changing error_flag.
       it_tbl_second = <VCL_TOTAL>.
       loop at it_tbl_second into wa_second.
         wa_tbl_second-vim_action = 'U'.
         modify it_tbl_second from wa_second
       endloop.
    endif.
    But to save modified entries of the second view to database I have to twice press SAVE buttons.
    The first time I have pressed SAVE above routines are executed and modified entries appear only in the second view internal table. The second time I have pressed SAVE modified entries appear in the database.
    I would like user press SAVE button only once. How I can do it?
    Regards,
    Malnor
    Edited by: Malnor on Nov 30, 2010 9:11 PM

    If I would append or change or delete records in the first view I want to add or change or delete some records in the second view
    Without a dependant field how will you perform this operation ?
    You have to link the fields in the tables, generate maintenance view, add it to cluster view and do it.

  • How to notify one subprocess from another subprocess

    Hi All
    I have a situation in which I need to notify one sub process from another sub process.e.g
    Let say Parent Process is - A
    First Child Process of A - a1 (Subprocess)
    Second Child Process of A - a2 (Subprocess)
    I have created Correlation for both the sub process. Now when I try to find a1(Subprocess) from an activity which is in a2(Subprocess), I am not able to do this.
    Code that I have used from a2(Subprocess) to notify a1(Subprocess) is as follows
    instanceId = Correlation.findInstanceBy(name : "a1Subprocess", values : {"a"});
    if(instanceId!=null){
    Notification.send(instanceId : instanceId, activityName : "TerminateA1", parameters : null);
    where "a1Subprocess" is Correlation name of a1(Subprocess) and "TerminateA1" is a NotificationWait activity in a1(Subprocess).
    Question is how can I correctly notify a1(Subprocess) from a2(Subprocess).
    Thanks in advance.

    Hi,
    There's another thread on this forum where I posted an answer to this today. Take a look at that.
    I'll admit that this is challenging (one of my simple 8 step processes), so I posted a working Oracle 10g Studio project example that has a split with notifications going between the child siblings. In the example on [Notification between siblings inside a Split activity|http://www.4shared.com/file/95299867/e7705994/CorrelationNotificationBetweenSplitSiblings.html] you'll see that this example aborts the sibling's instance (in the Interactive after the Notification Wait (now called Message Wait). Change the logic in this to suit your needs.
    Hope this helps,
    Dan

Maybe you are looking for