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. calling procedure within trigger

calling procedure within trigger

Scheduled Pinned Locked Moved Database
database
5 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.
  • M Offline
    M Offline
    Mr Kode
    wrote on last edited by
    #1

    i have insert trigger its function is insert one column in a table and stored procedure its function to insert data to remained columns in the same table . can i call the procedure within the trigger to perform row task completely or change my scenario regards

    A M 2 Replies Last reply
    0
    • M Mr Kode

      i have insert trigger its function is insert one column in a table and stored procedure its function to insert data to remained columns in the same table . can i call the procedure within the trigger to perform row task completely or change my scenario regards

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      Why not try it and see? Its quicker than posting a message and waiting for a reply :)

      Bob Ashfield Consultants Ltd

      M 1 Reply Last reply
      0
      • A Ashfield

        Why not try it and see? Its quicker than posting a message and waiting for a reply :)

        Bob Ashfield Consultants Ltd

        M Offline
        M Offline
        Mr Kode
        wrote on last edited by
        #3

        trigger text: Create trigger dbo.invoiceNum on invoice_summary fro insert as begin insert into invoice_details(invoice_num) select invoice_num from inserted exec insertInvoiceDetails /*stored procedure to insert to remained columns in invoice_details table */ end GO when trigger fired it insert the Invoice_num but when stored procedure fired it tries to insert new row and didn`t find invoice_num (Not Null column) then raised error thar Invoice_num don`t allow nulls regards

        A 1 Reply Last reply
        0
        • M Mr Kode

          trigger text: Create trigger dbo.invoiceNum on invoice_summary fro insert as begin insert into invoice_details(invoice_num) select invoice_num from inserted exec insertInvoiceDetails /*stored procedure to insert to remained columns in invoice_details table */ end GO when trigger fired it insert the Invoice_num but when stored procedure fired it tries to insert new row and didn`t find invoice_num (Not Null column) then raised error thar Invoice_num don`t allow nulls regards

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          So does your stored proc work outside the trigger, even with no parameters? You really need to try and cure these problems yourself, you get no benefit from other people telling you what is wrong - how do you think we find out these things?

          Bob Ashfield Consultants Ltd

          1 Reply Last reply
          0
          • M Mr Kode

            i have insert trigger its function is insert one column in a table and stored procedure its function to insert data to remained columns in the same table . can i call the procedure within the trigger to perform row task completely or change my scenario regards

            M Offline
            M Offline
            Member 3301325
            wrote on last edited by
            #5

            yes you can,.. trigger is a plsql block and u can call procs / funcs in it.

            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