Question

I am using Oracle SQL Live so please write the SQL Query in the format that...

I am using Oracle SQL Live so please write the SQL Query in the format that Oracle SQL Live can run

I need to create a trigger that will update the Product QoH when a new product is purchased. (A new product is purchased when a row is added to the line table).

I have linked the code of the script since it exceed Chegg’s Character Limit: https://docs.google.com/document/d/1HbHnMrk6Qw99B72kpDyYCFibUJVsYEi-6RKDsmb3fg4/edit?usp=sharing

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CREATE OR REPLACE TRIGGER update_Qoh

AFTER INSERT ON LINE

for each row

BEGIN

  update P

set P_QOH = P_QOH-1 where P_CODE = :new.P_CODE ;

update PRODUCT

set P_QOH = P_QOH-1 where P_CODE = :new.P_CODE;     

END;

/

""" Above code will get your job done. Thanks you.

Leave a thumps up :) """

Add a comment
Know the answer?
Add Answer to:
I am using Oracle SQL Live so please write the SQL Query in the format that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I am using Oracle SQL and am new to it. I have seven tables, one of...

    I am using Oracle SQL and am new to it. I have seven tables, one of them is a subtable of two of the others. I need to do the following queries: 1. List all Patients and what Bed they are assigned to 2. List all patients who had Treatments and what Treatment they received 3. List all patients who had tests and what Test they had 4. List the employees (doctors, nurses, etc.) who assisted each patient. 5. List...

  • Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add...

    Please write SQL Query for following questions using Northwind Database: 1. Create a procedure to add a new record to Territories table. Call it NewTerr. Add the following records using the procedure. TerritoryID        TerritoryDescription     Region 88888 Brooklyn 1 99999 Waco 4 77777 Long Beach 2 2. Create an Update Procedure that will change the Region from 1 to 3 for record with TerritoryID 88888. Call it Update88. 3. Create a Delete Procedure that will delete the one record from...

  • Using the code below in Oracle SQL Live I keep getting an error message for the...

    Using the code below in Oracle SQL Live I keep getting an error message for the last 4 INSERTS. The error message is: ORA-00932: inconsistent datatypes: expected DATE got NUMBER. How do I correct that error? CREATE TABLE BASE ( BASENUM CHARACTER(3) NOT NULL, BASECITY varchar(20), BASESTATE CHARACTER(2), BASEPHON varchar(10), BASEMGR varchar(10), PRIMARY KEY (BASENUM) ); CREATE TABLE TYPE ( TYPENUM CHARACTER(1) NOT NULL, TYPEDESC varchar(30), PRIMARY KEY (TYPENUM) ); CREATE TABLE TRUCK ( TNUM CHARACTER(4) NOT NULL, BASENUM CHARACTER(3),...

  • (Using Oracle SQL) How do I find the primary key of this table? And then how...

    (Using Oracle SQL) How do I find the primary key of this table? And then how do I consequently drop the primary key from the table? Edit: I was already give this code and it did not work select constraint_name,constraint_type from user_constraint where table_name='CUSTOMER'; Q7 (10 Points) Use ONE SQL statement to find out the name of the primary key constraint defined on Customer table. (Your SQL should return something like SYS_C0021715, numbers on your account may differ.) Then use...

  • I am using oracle sql developer to create some queries to generated reports and it is...

    I am using oracle sql developer to create some queries to generated reports and it is not working. I am not sure how to use count, group by, and order by. Help me fix my query and explain to me how you did, so can do it next time. Also, I have to convert this query to a stored procedure, so can you help me do it too? Here is my query: SELECT COUNT(GUEST.FIRSTNAME), GUEST.FIRSTNAME, GUEST.LASTNAME, GUEST.GUESTTYPE, RESERVATION.RESERVATIONDATE, GUEST.EMAIL, FROM...

  • Hello! I have this python Homework due tonight that I don't know how to do. Here...

    Hello! I have this python Homework due tonight that I don't know how to do. Here is a document with the data in the csv file, as I didn't know how to share it https://docs.google.com/document/d/1bDJVR2MqWKInvw5u0r3fOG3-CBmu3BEiPZwlaq_CShQ/edit?usp=sharing Activity #3: On the class website is a CSV file containing weather data from Coulter Field (in Bryan) for 3 years (1 day is missing for some reason!); the data was taken from Weather Underground (wunderground.com). There are different versions of the file for Windows...

  • Hi i need Help. i use MYSQL command line. THE QUESTION ARE BELOW please check the...

    Hi i need Help. i use MYSQL command line. THE QUESTION ARE BELOW please check the answer before you submit because sometimes query gives error thank you For Full database of SQL you can DOWNLOAD from this link: https://drive.google.com/file/d/1xh1TcBfMtvKoxvJr7Csgnts68fF53Q1t/view?usp=sharing ------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- What are the total sales for each year. Note that you will need to use the YEAR function. Order by year with the newest year first. ------------------------------------------------------- How many employees have no customers? ------------------------------------------------------------------ List the total sales for...

  • Please need serious and professional help! Hello! I am working on an "object oriented analysis and...

    Please need serious and professional help! Hello! I am working on an "object oriented analysis and design" Project. I would really need your sincere help in creating a vision document for this project. The Things That I require in the "vision document" is: 1. Product Overview [This section provides a high level view of the product capabilities, interfaces to other applications, and system configurations. This section usually consists of three subsections, as follows: •          Product perspective •          Product functions •         ...

  • Overview This lab provides you the opportunity to insert and update data with the use of SQL comm...

    Overview This lab provides you the opportunity to insert and update data with the use of SQL commands. The lab will utilize the FLIX2YOU problem, the current schema. In order to start this lab, you must have successfully completed Lab # 6. In Lab # 6, you executed a script that was provided to you. This script created 7 of the FLIX2YOU tables as documented in the Entity Relationship Diagram in the FLIX2YOU problem document. The second part of lab...

  • If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top o...

    If possible please just send the SQL statement. Thank you Each question within deliverable 3 must begin on a new page and be sure to document the question as the title of each item at the top of each page. Also, using a 12-point font, include the SQL statement and then provide a screen shot of each query. The screen shots must include both the SQL statement and the results for each item below based on the data entered in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT