Execute Immediate in PL/SQL Explained with example.

Поділитися
Вставка
  • Опубліковано 7 вер 2024
  • Execute Immediate is mainly used to run native dynamic sql, This video takes a lay men approach to easily but precisely explain the concept using real project examples.
    #DynamicQuery #ExecuteImmediate #TechCoach

КОМЕНТАРІ • 37

  • @shashank2004
    @shashank2004 6 років тому +3

    Nice explanation sir,pls make a video on all types of hints, reverse key index, deterministic function, pipeline function , performance tuning & tricky sql interview questions.

    • @TechCoach
      @TechCoach  6 років тому

      Hints and reverse key index are in my plan and you should see a video on them soon. For performance tuning I will also recommend watching my video series on partitioning.Thanks a lot for the kind words :)

  • @devanaidu9406
    @devanaidu9406 6 років тому

    Hi bro superb explanation..every one can easily understand thank you for sharing bro..and also pls share 1).what is WHERE CURRENT OF CLAUSE,2).WHAT IS FOR UPDATE CLAUSE.and 3).what is refcursor why we using..thank you in advanced bro

  • @mynamefootball
    @mynamefootball 6 років тому +1

    Hi Vivek,
    You have explained it very well please explain complete oracle sql in detail.
    Thanks in advance .

    • @TechCoach
      @TechCoach  6 років тому

      Sure Kajal, I will upload more videos soon.Thanks for the kind words :)

  • @abdulmazid7615
    @abdulmazid7615 2 роки тому +1

    Sir have created 24partitions of each hour table now I want to drop 20 partitions and insert data into 4 partitions in the same block using execute immediate please share your answer

    • @TechCoach
      @TechCoach  2 роки тому

      Created named partition so that you can easily identify and delete them

  • @anirudhalluru8021
    @anirudhalluru8021 Рік тому

    We can run dml statements inside a procedure, but why its not happening with delete ??

  • @priyankasuryawanshi6911
    @priyankasuryawanshi6911 Рік тому

    Create Or Replace Procedure Proc1(table_name varchar2)
    As
    Begin
    Execute Immediate 'delete from' ||table_name;
    End Proc1;
    execute Proc1('Exe_Tab2'); --when I tried to execute: execute Proc1('Exe_Tab2'); this command I am getting error that 'table or view does not exist'.. but table is already created with records.. can you please help.

  • @ztech4634
    @ztech4634 3 роки тому +1

    Awesome explanation

    • @TechCoach
      @TechCoach  3 роки тому

      Thanks a lot buddy for the kind words :)

  • @VikramKumarpage
    @VikramKumarpage 6 років тому +1

    thanks vivek sir,,,,,could you please make videos on types/collection/array. thanks in advance

  • @rohitjethwani626
    @rohitjethwani626 4 роки тому

    nyc video but I want to know more uses of execute immediate with examples.Please upload more video on it.

    • @TechCoach
      @TechCoach  4 роки тому

      If you want to execute a DDL inside a procedure you need to use execute immediate, if you want to create sql dynamically based on data driven scenarios then you need to use execute immediate

  • @harikavitechnologicalfacts1334
    @harikavitechnologicalfacts1334 3 роки тому

    Thanks for the video... helped a lot

    • @TechCoach
      @TechCoach  3 роки тому

      Thanks Buddy I am glad I could help

  • @vickypatekar9532
    @vickypatekar9532 4 роки тому

    It's a waaaww! Vedio Thanks Sir 🙏

    • @TechCoach
      @TechCoach  4 роки тому +1

      Thanks a lot for the kind words Vicky :)

  • @ramKumar-lf7er
    @ramKumar-lf7er 2 роки тому

    Dynamic SQL how to use using class in SQL injection

  • @cybernetinc3775
    @cybernetinc3775 2 роки тому

    Will I be able to do this without execute Immediate?
    BEGIN
    FOR Row_Call IN (SELECT * FROM My_Tmp_Tbl)
    LOOP
    DELETE FROM My_Orig_Tbl WHERE user_id = Row_Call.user_id
    AND join_date = Row_Call.join_date;
    -- Some more task
    END LOOP ;
    END;

  • @ankushgondane8642
    @ankushgondane8642 6 років тому

    Thank you Vivek 😊

    • @TechCoach
      @TechCoach  6 років тому

      +Ankush Gondane You are welcome :)

  • @ayush120793
    @ayush120793 6 років тому +1

    Hi Vivek,
    First of all, thanks for wonderful explanation. While executing a procedure where I am passing an integer into procedure block
    Egi: exec proc1(7);...This integer is nothing but an Employee ID of a certain table name as Employee.
    And when the block statement is getting executed, it is deleting the record. PFB procedure:
    Create or replace procedure proc1(Emp_ID)
    As
    Begin
    Delete from Employee where empid=Emp_ID;
    End;
    Here Employee is table having column as empid and empname.
    As per my understanding the sql over there is dynamic one where it is accepting runtime value 7. But it is getting executed successfully without using 'Execute Immediate'
    Could you please clarify what I misunderstood?
    Appreciate all your help!!!

    • @TechCoach
      @TechCoach  6 років тому

      Thanks a lot for the kind words.Dynamic sql is slightly different from what you have mentioned.Dynamic sql statements are usually used when you don't know the table name or where clause or similar stuff.

    • @ayush120793
      @ayush120793 6 років тому +1

      Thanks for the clarification Sir!!!...I got your point...

    • @TechCoach
      @TechCoach  6 років тому

      Hi Ayush I am working on this new youtube channel, It would be of immense help if you and subscribe.
      ua-cam.com/channels/oLdaMxhfDgdgIAcRGlUvkg.html

    • @ayush120793
      @ayush120793 6 років тому

      Done!!!!

  • @ushathoughts7182
    @ushathoughts7182 3 роки тому

    Hi friend. How to use DQL statement in PL/SQL.means what about select statement

    • @TechCoach
      @TechCoach  3 роки тому

      They Can be used easily inside begin end section , Let me know if you need some sample code :)

  • @mahendraeee3637
    @mahendraeee3637 2 роки тому +1

    I need plsql job support can you help me

    • @TechCoach
      @TechCoach  2 роки тому

      I am sorry Mahendra, I am not providing any job support at the moment

  • @ramKumar-lf7er
    @ramKumar-lf7er 2 роки тому

    Can you do videos on SQL injection concept

  • @ruchitrivedi7841
    @ruchitrivedi7841 5 років тому

    Can you explain Collections,Triggers and Cursors?

    • @AnIndianAbroadd
      @AnIndianAbroadd 5 років тому

      Sure Ruchi I will work on it soon.
      I need a small help I am working on this new youtube channel and would really appreciate if you watch and subscribe to it.
      ua-cam.com/video/11DK-oyRql0/v-deo.html

  • @aishwaryaghumekar4819
    @aishwaryaghumekar4819 4 роки тому

    Thank you. This video was helpful. However I am trying to implement a query where I want to copy the data from 1 table to another and the table names have to be provided dynamically. I am using the below query and it's throwing error as:
    'PLS-00103: Encountered the symbol "select * from " when expecting one of the following: . ( * @ % & = - + ; < / > at in is mod remainder not rem or != or ~= >=

    • @TechCoach
      @TechCoach  4 роки тому

      Hi Aishwarya, you are missing || before select.

    • @aishwaryaghumekar4819
      @aishwaryaghumekar4819 4 роки тому

      @@TechCoach Thanks, this worked. Also, do you have any knowledge about how to import and use this procedure in Informatica Powercenter? Just curious.