Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the ORD table create a stored function called custord that will use a cust

ID: 3532765 • Letter: U

Question

Using the ORD table create a stored function called custord that will use a customer id (CUSTID) that will return the sum of the specified customer id TOTAL field. When your function has been stored run the following SQL: begin dbms_output.put_line('customer 102 total is ' || custord(102)); end;

Explanation / Answer

SQL> CREATE or REPLACE FUNCTION custord (custNo IN number) 2 RETURN NUMBER 3 IS cust_tot NUMBER(11,2); 4 BEGIN 5 SELECT sum(cust_total_field) 6 INTO cust_tot 7 FROM ord 8 WHERE cust_number_field=custNo; 9 RETURN(cust_tot); 10 END; 11 / Warning: Function created with compilation errors. SQL> begin 2 dbms_output.put_line('customer 102 total is ' || custord(102)); 3 end; 4 / dbms_output.put_line('customer 102 total is ' || custord(102)); * ERROR at line 2: ORA-06550: line 2, column 52: PLS-00905: object CIS605.CUSTORD is invalid ORA-06550: line 2, column 3: PL/SQL: Statement ignored

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote