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 8885429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:18:35+00:00 2026-06-14T21:18:35+00:00

How can I call the return value of the first function into the second

  • 0

How can I call the return value of the first function into the second function? Here is the first function to count the number of visits a customer makes to my shop:

CREATE OR REPLACE  FUNCTION CALCULATE ( NUM CUSTOMER.CUST_VISIT%TYPE)
RETURN NUMBER
IS
V_CUST_VISIT NUMBER(3);
V_COUNT INTEGER;
BEGIN
SELECT CUST_VISIT
INTO V_CUST_VISIT
FROM CUSTOMER, BOOKING
WHERE CUSTOMER.CUST_ID = BOOKING.CUST_ID;
SELECT MAX(COUNT(*)) 
INTO v_count
FROM BOOKING
GROUP BY CUST_ID
HAVING count(*)>=0;

CASE v_count
WHEN 3 THEN v_cust_visit:= v_count; 
DBMS_OUTPUT.PUT_LINE('10% DISCOUNT DUE');

WHEN 6 THEN v_cust_visit:= v_count;
DBMS_OUTPUT.PUT_LINE('20% DISCOUNT DUE');

WHEN 9 THEN v_cust_visit:= v_count;
DBMS_OUTPUT.PUT_LINE('30% DISCOUNT DUE');

ELSE v_cust_visit:= v_count;
DBMS_OUTPUT.PUT_LINE('OOPS NO DISCOUNT DUE YET! AFTER THREE BOOKINGS');
END CASE;
END;
/
Where in the second function:
CREATE OR REPLACE FUNCTION CALC_BILL
(BILL_NUM TREATMENT.TREAT_COST%TYPE)

RETURN NUMBER

IS

CUST_ID VARCHAR2(4);
TREAT_COST NUMBER(10,2);
v_TREAT_cost TREATMENT.TREAT_COST%TYPE; 
DISCOUNTED_BILL NUMBER(10,2);
NO_DISCOUNT EXCEPTION;

BEGIN

SELECT TREAT_COST 
INTO v_treat_cost 

FROM CUSTOMER C, TREATMENT T, TREAT_SESSION TS
WHERE C.CUST_ID = TS.CUST_ID 
AND T.TREAT_ID = TS.TREAT_ID;

IF
CALCULATE() :=3 –this is how I tried and it hasnt work–
THEN
DISCOUNTED_BILL:= v_treat_cost-(v_treat_cost*0.1);

ELSIF
CALCULATE := 6
THEN
DISCOUNTED_BILL := v_treat_cost-(v_treat_cost*0.2);

ELSIF
CALCULATE := 9
THEN
DISCOUNTED_BILL := v_treat_cost-(v_treat_cost*0.3);
ELSE
RAISE NO_DISCOUNT;

 END IF;
 END;
 /
  • 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-06-14T21:18:36+00:00Added an answer on June 14, 2026 at 9:18 pm

    Assign the function call to a variable:

        some_number_result := calculate(some_input);
    
        if some_number_result = 1 then 
           -- do stuff
        end if;
    

    etc…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I call eBay and request it to return search results array? This
How, if it's possible, can you call a method from another method's return ?
Using a delegate I can call any function asynchronously. From the documentation I understand
When inside a function can I get it's parameters name/value? I'm looking to turn
I can call the webservie directly to the browser with the following URL and
In Ruby I can call methods with array elements used as positional parameters like
With CreateProcessAsUser I can call an .exe file somewhere on the hard disk: CreateProcessAsUser(IntPtr
Since you can call the the Soundcloud API via XHR (because of the CORS
From this code I can call bmwCars.CopyToDataTable() as I expected. var bmwCars = from
I understand that I can call ToString().IndexOf(...), but I don't want to create an

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.