Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Create an sql script that compares two dbase and updates dbase and insert date of update in a column in oracle 11g

Create an sql script that compares two dbase and updates dbase and insert date of update in a column in oracle 11g

Scheduled Pinned Locked Moved Database
databaseoracletoolshelpquestion
18 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    Miguel Quintanilla wrote:

    IS IT POSIBLE TO MAKE A DBLINK

    Like this[^]?

    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

    M Offline
    M Offline
    Miguel Quintanilla
    wrote on last edited by
    #9

    I HAVE DONE THIS DBLINK: CREATE DATABASE LINK DB_2 CONNECT TO COMPUSOFT IDENTIFIED BY albosapam02 USING 'inv2' AND THEN I HAVE DONE THIS: SELECT * FROM PESAJE MINUS SELECT * FROM PESAJE@DB_2 IT GIVES ME A RESULT BUT NOW I WANT TO INSERT THAT RESULT IN THE DB_2 AND STORE THE QUERY SO I CAN cALL IT ON THE JOB.. aNY HELP???

    L 1 Reply Last reply
    0
    • M Miguel Quintanilla

      I HAVE DONE THIS DBLINK: CREATE DATABASE LINK DB_2 CONNECT TO COMPUSOFT IDENTIFIED BY albosapam02 USING 'inv2' AND THEN I HAVE DONE THIS: SELECT * FROM PESAJE MINUS SELECT * FROM PESAJE@DB_2 IT GIVES ME A RESULT BUT NOW I WANT TO INSERT THAT RESULT IN THE DB_2 AND STORE THE QUERY SO I CAN cALL IT ON THE JOB.. aNY HELP???

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #10

      Your message is all in caps-lock; on the internet that's interpreted as shouting.

      Miguel Quintanilla wrote:

      IT GIVES ME A RESULT BUT NOW I WANT TO INSERT THAT RESULT IN THE DB_2 AND STORE THE QUERY SO I CAN cALL IT ON THE JOB..
      aNY HELP??

      With what exactly? You can select and insert; please describe the problem you're having.

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      M 1 Reply Last reply
      0
      • L Lost User

        Your message is all in caps-lock; on the internet that's interpreted as shouting.

        Miguel Quintanilla wrote:

        IT GIVES ME A RESULT BUT NOW I WANT TO INSERT THAT RESULT IN THE DB_2 AND STORE THE QUERY SO I CAN cALL IT ON THE JOB..
        aNY HELP??

        With what exactly? You can select and insert; please describe the problem you're having.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        M Offline
        M Offline
        Miguel Quintanilla
        wrote on last edited by
        #11

        Ok i have the result from the both db's in this query now i want to insert the result in DB_2 this the query that gives me the result: select /*+ FULL(Tbl1) */ PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO from COMPUSOFT.PESAJE Tbl1 minus select /*+ FULL(Tbl2) */ PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO from COMPUSOFT.PESAJE@"DB_2" Tbl2 Order by PSJ_GESTION ASC NULLS LAST, PSJ_COD ASC NULLS LAST, PSJ_PLACA ASC NULLS LAST, PSJ_PESO ASC NULLS LAST, PSJ_FECHA ASC NULLS LAST, PSJ_ESTADO ASC NULLS LAST, BLZ_COD ASC NULLS LAST, MNF_COD ASC NULLS LAST, DMN_COD ASC NULLS LAST, USR_COD ASC NULLS LAST, TIC_COD ASC NULLS LAST, PSJ_TARA ASC NULLS LAST, PSJ_NETO ASC NULLS LAST

        L 1 Reply Last reply
        0
        • M Miguel Quintanilla

          Ok i have the result from the both db's in this query now i want to insert the result in DB_2 this the query that gives me the result: select /*+ FULL(Tbl1) */ PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO from COMPUSOFT.PESAJE Tbl1 minus select /*+ FULL(Tbl2) */ PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO from COMPUSOFT.PESAJE@"DB_2" Tbl2 Order by PSJ_GESTION ASC NULLS LAST, PSJ_COD ASC NULLS LAST, PSJ_PLACA ASC NULLS LAST, PSJ_PESO ASC NULLS LAST, PSJ_FECHA ASC NULLS LAST, PSJ_ESTADO ASC NULLS LAST, BLZ_COD ASC NULLS LAST, MNF_COD ASC NULLS LAST, DMN_COD ASC NULLS LAST, USR_COD ASC NULLS LAST, TIC_COD ASC NULLS LAST, PSJ_TARA ASC NULLS LAST, PSJ_NETO ASC NULLS LAST

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #12

          INSERT INTO TableName
          SELECT [...]

          Source[^]

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

          M 1 Reply Last reply
          0
          • L Lost User

            INSERT INTO TableName
            SELECT [...]

            Source[^]

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

            M Offline
            M Offline
            Miguel Quintanilla
            wrote on last edited by
            #13

            I have try this: Insert into COMPUSOFT.PESAJE@DB_2 select /*+ FULL(Tbl1) */ PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO from COMPUSOFT.PESAJE Tbl1 minus select /*+ FULL(Tbl2) */ PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO from COMPUSOFT.PESAJE@"DB_2" Tbl2; But i get "missing values"

            L 1 Reply Last reply
            0
            • M Miguel Quintanilla

              I have try this: Insert into COMPUSOFT.PESAJE@DB_2 select /*+ FULL(Tbl1) */ PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO from COMPUSOFT.PESAJE Tbl1 minus select /*+ FULL(Tbl2) */ PSJ_GESTION, PSJ_COD, PSJ_PLACA, PSJ_PESO, PSJ_FECHA , PSJ_ESTADO, BLZ_COD, MNF_COD, DMN_COD, USR_COD , PSJ_OPERACION, TIC_COD, PSJ_TARA, PSJ_NETO from COMPUSOFT.PESAJE@"DB_2" Tbl2; But i get "missing values"

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #14

              Miguel Quintanilla wrote:

              But i get "missing values"

              Can you post the complete message? This would only work if the table you're inserting to has columns to match the query's result.

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

              M 1 Reply Last reply
              0
              • M Miguel Quintanilla

                Hi many thanks for all the help you give me. here is my problem i want to use me of this: this i have on toad: -- run every 5 MINUTES BEGIN dbms_scheduler.create_schedule( schedule_name => 'INTERVAL_EVERY_5_MINUTES', start_date => trunc(sysdate)+18/24, repeat_interval => 'freq=MINUTELY;interval=5', comments => 'Runtime: Every day all 5 minutes'); END; / begin -- Call a procedure of a database package dbms_scheduler.create_program (program_name=> 'PROG_COLLECT_SESS_DATA', program_type=> 'STORED_PROCEDURE', program_action=> '?????? i dont have this yet', enabled=>true, comments=>'Procedure to collect session information' ); end; begin -- Connect both dbms_scheduler parts by creating the final job dbms_scheduler.create_job (job_name => 'JOB_COLLECT_SESS_DATA', program_name=> 'PROG_COLLECT_SESS_DATA', schedule_name=>'INTERVAL_EVERY_5_MINUTES', enabled=>true, auto_drop=>false, comments=>'Job to collect data about session values every 5 minutes'); end; I AM GOING TO USE THIS SCHEDULED JOB AND NOW I WANT TO CREATE MY SQL AND I HAVE A LITTLE BIT OF TROUBLE. I HAVE DONE THIS DBLINK: CREATE DATABASE LINK DB_2 CONNECT TO COMPUSOFT IDENTIFIED BY albosapam02 USING 'inv2' AND THEN I HAVE DONE THIS: SELECT * FROM PESAJE MINUS SELECT * FROM PESAJE@DB_2 IT GIVES ME A RESULT BUT NOW I WANT TO INSERT THAT RESULT IN THE DB_2 AND STORE THE QUERY SO I CAN ALL IT ON THE JOB.. aNY HELP???

                M Offline
                M Offline
                Mycroft Holmes
                wrote on last edited by
                #15

                Sorry my knowledge of Oracle and DB2 is very limited, I'm not going to be able to help with the details on those platforms. Oracle has a dedicated support forum, Ask Ted I think, you should get more relevant support there!

                Never underestimate the power of human stupidity RAH

                M 1 Reply Last reply
                0
                • M Mycroft Holmes

                  Sorry my knowledge of Oracle and DB2 is very limited, I'm not going to be able to help with the details on those platforms. Oracle has a dedicated support forum, Ask Ted I think, you should get more relevant support there!

                  Never underestimate the power of human stupidity RAH

                  M Offline
                  M Offline
                  Miguel Quintanilla
                  wrote on last edited by
                  #16

                  Thanks anyway

                  1 Reply Last reply
                  0
                  • L Lost User

                    Miguel Quintanilla wrote:

                    But i get "missing values"

                    Can you post the complete message? This would only work if the table you're inserting to has columns to match the query's result.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                    M Offline
                    M Offline
                    Miguel Quintanilla
                    wrote on last edited by
                    #17

                    I have solved it ! It was a missmatch in the first select ok how do i store the query so i can call it in a store_procedure

                    L 1 Reply Last reply
                    0
                    • M Miguel Quintanilla

                      I have solved it ! It was a missmatch in the first select ok how do i store the query so i can call it in a store_procedure

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #18

                      Doesn't Oracle have a "create procedure" or something similar? :)

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups