DBAsupport.com Forums - Powered by vBulletin
Results 1 to 10 of 10

Thread: its urgent plz provide the solution to this query

  1. #1
    Join Date
    Aug 2007
    Posts
    18

    its urgent plz provide the solution to this query

    hi

    here is the example, where i want to copy the data in the following format.


    Table : s1

    ecode ename sal
    101 xxx 1000
    109 yyy 2000
    103 zzz 3000


    Table : s2

    ecode ename
    101 xxx
    109 yyy
    103 zzz


    i want to copy sal column with data of s1 table to s2 table.

  2. #2
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Is this a college assignment?
    Here is a hint, you have to update table S2 when S2.ecode = S1.ecode.
    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.

  3. #3
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    Buys a book or go to some class
    Cheers!
    OraKid.

  4. #4
    Join Date
    Aug 2007
    Posts
    18

    plz send the complete query

    there is no sal column in my table s2, then how can i use update command


    iam learning oracle on my own, recently started. so iam getting doubts. nobody is for me to clear my doubts. i cant afford money to learn oracle. i came to know of ur web site thru my friend so is the reason iam posting all my doubts. if my doubts are irritating u, jst excuse me with ur big heart.

    thankx in advance.

  5. #5
    Join Date
    Dec 2000
    Posts
    126

    no column in table

    there is no sal column in my table s2, then how can i use update command
    where do you keep sal value if no column defined in table s2 ?

  6. #6
    Join Date
    Apr 2001
    Location
    Vadodara, India
    Posts
    249
    If your table S2 dones no contain SAL column and if you want than 1st you have to add that column in S2 table using

    alter table s2 add (sal number());

    after that you can update this column as PAVB suggested.

  7. #7
    Join Date
    Sep 2007
    Posts
    36
    Your update will need to look like this:

    UPDATE s2
    SET s2.sal = (SELECT s1.sal
    FROM s1
    WHERE s2.ecode = s1.ecode)

  8. #8
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Quote Originally Posted by jay_l_a
    Your update will need to look like this:

    UPDATE s2
    SET s2.sal = (SELECT s1.sal
    FROM s1
    WHERE s2.ecode = s1.ecode)
    OP stated he wants to learn so IMHO this is the wrong approach... "give a man a fish, and you feed him for a day, teach him to fish, and you feed him for a lifetime".
    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.

  9. #9
    Join Date
    Sep 2007
    Posts
    36
    Quote Originally Posted by PAVB
    OP stated he wants to learn so IMHO this is the wrong approach... "give a man a fish, and you feed him for a day, teach him to fish, and you feed him for a lifetime".

    I agree to an extent, but nearly a week after originally posting 'its urgent plz provide the solution to this query', and not seeming any closer to a solution, I thought it time to counter some of the more sardonic replies the OP had received.

  10. #10
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    got you but, this wasn't a production issue therefore no "urgent plz..." applies.
    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