Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6853251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:29:23+00:00 2026-05-27T01:29:23+00:00

I’m rather new to Oracle PL/SQL, so I’m not sure whether it’s possible to

  • 0

I’m rather new to Oracle PL/SQL, so I’m not sure whether it’s possible to do something like this:

Two tables – T1 and T2 – T1.id is foreign key referencing T2.id, each table has a sequence;
I’ve written a function that when it’s called allows the user to insert new rows in T1 – will call it func1, same for T2 – func2;
Also a function that get us the last inserted sequence in a table – getLastSeq(table);

So, now I’m trying to create a trigger after insert on T2 calls func1, allowing the user to write the input info.

CREATE OR REPLACE TRIGGER trig1
AFTER INSERT ON T2
DECLARE
-----?----
BEGIN
----?----
dbms_output.put_line(func1(:col1, :col2));
----?----?
END;

But all my possible attempts to do so die with errors about :col1 not being a bad bind var.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:29:24+00:00Added an answer on May 27, 2026 at 1:29 am

    I’m not quite sure that I understand what you’re trying to accomplish.

    1. If you are creating a PL/SQL block that inserts a row, that really ought to be a procedure, not a function. A function is supposed to perform a computation and return a result. A procedure is supposed to do DML.
    2. I’m not sure what you mean by “allowing the user to write the input info”. PL/SQL has no facilities to prompt the user for input– it can only accept input parameters.
    3. I’m not sure that I understand how an insert into a parent table (T2) could ever logically insert a row into a child table (T1). That would imply that T1 is not really a child table which implies that you have some sort of problem with the data model.

    If your goal is to pass the newly inserted COL1 and COL2 tables from the row that was just inserted into T2 to the PROC1 procedure, my guess is that you want something like

    CREATE OR REPLACE TRIGGER trig_t2
      AFTER INSERT ON t2
      FOR EACH ROW
    BEGIN
      proc1( :new.col1, :new.col2 );
    END;
    

    It sounds, though, like you may not want to use a trigger at all. If you want to create an order, you’d normally have a procedure that executes multiple INSERT statements rather than trying to insert into the child table from a trigger on the parent. Something like this, for example, is going to be much clearer and much easier to maintain than a trigger-based solution.

    CREATE OR REPLACE PROCEDURE create_order( p_order_description IN VARCHAR2 )
    AS
    BEGIN
      INSERT INTO order( order_id, description )
        VALUES( order_id_seq.nextval, p_order_description );
    
      INSERT INTO order_ship_status( order_ship_status_id, order_id, status )
        VALUES( order_ship_status_id.nextval, order_id_seq.currval, 'Not Shipped' );
    END:
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
this is what i have right now Drawing an RSS feed into the php,
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.