PL/SQL tutorial 17: Make synchronized backup copy of a table using DML Trigger

  Рет қаралды 113,949

Manish Sharma

Manish Sharma

Күн бұрын

Пікірлер: 49
@shreeratan567
@shreeratan567 6 жыл бұрын
bro code is perfect and i'm in love with your explaination.you are G.O.A.T!!
@arungupta5528
@arungupta5528 4 жыл бұрын
Nice video bro.. thanks for sharing your knowledge
@CidaLunacorteecostura
@CidaLunacorteecostura 7 жыл бұрын
I liked this video and your explanation. Thank you!
@khyatiist
@khyatiist 4 жыл бұрын
Awesome explanation Manish. Thanks for sharing. Please tell me what does 1=2 in the where clause mean? Sorry if that's basic but I have never used it.
@Rebellionrider
@Rebellionrider 4 жыл бұрын
Thank you so much. I am glad that you liked my video. Your appreciation means a lot to me. Regarding 1=2, it is an always false condition, like 0>1 or True = False.
@khyatiist
@khyatiist 4 жыл бұрын
@@Rebellionrider You deserve the appreciation Manish. Thanks for your prompt response. If it is a false condition then why is a where clause even needed?
@achillles6838
@achillles6838 4 жыл бұрын
@@khyatiist it is used just to copy the structure of the table not the data. if you you want to copy the data and structure both then 1=1 is used.
@amanmishra529
@amanmishra529 7 жыл бұрын
hats off guruji :)
@javaandroid6964
@javaandroid6964 6 жыл бұрын
Great explanation , why these channels have less views and likes
@abdihakimmohamed6309
@abdihakimmohamed6309 4 жыл бұрын
Thank you Manish for the tutorial. Whenever I use the pseudo record :NEW or even :OLD I get an error I don't know why. I had to even copy the code from your blog but still throwing an error. I am using Oracle12c. There is a red line below the pseudo record. Help !!!!!!!!!!!
@sahilehsan5728
@sahilehsan5728 5 жыл бұрын
I had observe some cases. This trigger query is ok and will work absolutly with single column. But what about if I am having more than 50 columns in a table. How we can write update statement for that? Can you share me script as well for the above query.
@aviksengupta4879
@aviksengupta4879 5 жыл бұрын
can you please provide me a query? I have inserted one row values in a backup table, create TABLE_BK as select * from TABLE where DOC_ID = ABC; now I deleted DOC_ID = ABC from TABLE, now I need to insert all the values of row where DOC_ID = ABS from TABLW_BK to main TABLE.
@ManojYadav-lc3by
@ManojYadav-lc3by 8 жыл бұрын
i need to create a backup copy of same table in different database and that should be updated when primary table is getting updated. is this possible with this trigger?
@armanalirahul
@armanalirahul 2 жыл бұрын
can you plz tell me why we use where expression? ( WHERE 1 = 2) in this query --> CREATE TABLE superheroes_backup AS SELECT * FROM superheroes WHERE 1=2;
@rahulkumarprasad7803
@rahulkumarprasad7803 4 жыл бұрын
Hi Manish, I really respect your hard word and thank you once again that makes us to understand your videos. But I have a doubt . As you explain in this video that we can create synchronized backup copy of a table but what is the use of this back up table. I mean if we delete one record from main table , it will reflect in back up table too so could you please clear my doubt ??please any one ?
@phuoccao4951
@phuoccao4951 4 жыл бұрын
same thoughts!
@poojatr897
@poojatr897 Жыл бұрын
Yes if we make any changes (insert/delete/update) in main table then obviously it reflects on backup table as we created backup table with condition 1=2. I hope you understood 😊
@enriqueruiz3904
@enriqueruiz3904 7 жыл бұрын
Thanks for your time!!
@bdub229
@bdub229 7 жыл бұрын
Hi Great videos. I do have a question, Can you have multiple "SET column =:new.column WHERE column =:old.column;" in an ELSIF statement. I have created a movies table and if i wanted to update a certain column can this be done with "SET column =:new.column WHERE column =:old.column;" statement or is this something more advanced in some of your later tutorials? Thanks Bdub
@pranaytanniru7764
@pranaytanniru7764 6 жыл бұрын
UPDATE table-name SET column-name = value, column-name = value, ... WHERE condition You can use this to update multiple columns
@Faizyxyz
@Faizyxyz 8 жыл бұрын
Hi Manish Sir, I just want to know in this query INSERT INTO superheroes_backup (SH_NAME) VALUES (:NEW.SH_NAME); you have given superheroes_backup table name then after (SH_NAME) why so i am confused here why have you given this (SH_NAME)
@pranaytanniru7764
@pranaytanniru7764 6 жыл бұрын
here it's optional, you can specify the column names while inserting in case if you are not inserting the data in the order of table columns or you want to insert data for only few columns.
@gulzarsiddique8908
@gulzarsiddique8908 8 жыл бұрын
can we use multiple columns in this program for backup ???
@thulasireddy4514
@thulasireddy4514 Жыл бұрын
What is the difference between before and after
@davidmakinde4291
@davidmakinde4291 4 жыл бұрын
wonderful explanation. But i ran the same code and it compiles. But when i update or insert into the table, it tells me trigger compilation or authorisation error. Don't know why?
@Rebellionrider
@Rebellionrider 4 жыл бұрын
Make sure the user through which you executing the trigger have all the necessary privileges for running it.
@vikram4755
@vikram4755 8 жыл бұрын
Thanks that nice, but just a question, as you are executing this query in a one session hence you would be able to see insert, update and delete result. But if a user from different session views backup table, that would have nothing, as there is no commit!
@Bhuvana9828
@Bhuvana9828 Жыл бұрын
We have to run commit command.
@shikharchaudhary6984
@shikharchaudhary6984 7 жыл бұрын
in oracle isql plus this is coming for same code , Warning: Trigger created with compilation errors . What to do ?
@harshjain1207
@harshjain1207 8 жыл бұрын
What does 1=2 means?? is 1 means table 1 and 2 means table 2???
@SergeantTrigger
@SergeantTrigger 8 жыл бұрын
it's a common statement/condition if u intend to duplicate a table but not copying it's content. 1=2 is false
@Faizyxyz
@Faizyxyz 8 жыл бұрын
where 1=2 mean just creating the table with the same structure with out copying the data.
@ahosanhabib9399
@ahosanhabib9399 5 жыл бұрын
faiza and sabillena, thank you :)
@anushat2597
@anushat2597 3 жыл бұрын
How to get a copy of table along with constraints and indexes
@CyberAZT
@CyberAZT 9 жыл бұрын
Thanks
@rameshas7184
@rameshas7184 4 жыл бұрын
How to achieve this in oracle form plsql trigger
@krishnasingh-ob6ob
@krishnasingh-ob6ob 4 жыл бұрын
ORA-04079: invalid trigger specification give error all time
@parag4982
@parag4982 4 жыл бұрын
What us the purpose of 1=2?
@sameer26121980
@sameer26121980 7 жыл бұрын
Thanks for the explanation. What is the difference between BEFORE and AFTER? I tried creating a trigger with BEFORE. I made changes to the superheroes table.. alter table superheroes modify (sh_name integer); insert into superheroes (sh_name) values ('batman'); The main insert failed (as expected), but I did not see the record inserted into superheroes_bkp table. If the insert into superheroes_bkp table happens BEFORE the main table, then why the record is not visible in superheroes_bkp table? Or may be my understanding is wrong about BEFORE/AFTER. Is there a way to capture the insert even if the main insert fails?
@rajanbansal1355
@rajanbansal1355 7 жыл бұрын
want to know that we are writing keyword inserting deleting updating whether it is ok writing ing with insert delete update how system know that inserting means insert
@codingwithtoaster8690
@codingwithtoaster8690 6 жыл бұрын
They are predefined predicates in the oracle database. He talked about it in previous videos.
@rahulkumarprasad7803
@rahulkumarprasad7803 4 жыл бұрын
Inserting is a keyword in Oracle.
@zhengkeongng2892
@zhengkeongng2892 4 жыл бұрын
What does "where 1=2" means?
@Rebellionrider
@Rebellionrider 4 жыл бұрын
It means "Always Not Equal". 1 will never be equal to 2. If you want you can also use 0=1 or 2 =9 whatever you feel comfortable with.
@rahulkumarprasad7803
@rahulkumarprasad7803 4 жыл бұрын
Hey Manish .. I know you have a comment notification regarding this video .Please reply me the same.
@Prasadd11
@Prasadd11 9 ай бұрын
what if i do delete from superheroes; update superheroes set sh_name='Ironman'; this trigger will not make a copy of the original table to backup table
@marketingpaathshala3126
@marketingpaathshala3126 6 жыл бұрын
what does this DESC means ?
@codingwithtoaster8690
@codingwithtoaster8690 6 жыл бұрын
describe
@tarunsmdtp
@tarunsmdtp 4 жыл бұрын
can we backup the data from one DB to another DB as well?
PL/SQL tutorial 18: DDL Trigger with Schema Auditing Example
8:12
Manish Sharma
Рет қаралды 117 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
you need to learn SQL RIGHT NOW!! (SQL Tutorial for Beginners)
24:25
NetworkChuck
Рет қаралды 1,7 МЛН
Querying 100 Billion Rows using SQL, 7 TB in a single table
9:07
Arpit Agrawal (Elastiq.AI)
Рет қаралды 59 М.
7 Database Design Mistakes to Avoid (With Solutions)
11:29
Database Star
Рет қаралды 99 М.
Oracle interview Question : what is trigger in oracle
10:56
Siva Academy
Рет қаралды 153 М.
Oracle PL SQL interview question Instead of Trigger
6:26
Siva Academy
Рет қаралды 64 М.
Learn SQL Basics in Just 15 Minutes!
16:57
Kenji Explains
Рет қаралды 198 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 54 МЛН