Created
May 24, 2019 00:47
-
-
Save bobby5892/7c1a2ae4695329f63549a0dc618543fd to your computer and use it in GitHub Desktop.
Wk8-in-class-weds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION inCart (Product_ID IN VARCHAR2) RETURN BOOLEAN | |
IS | |
doesExist boolean := false; | |
matches number := 0; | |
BEGIN | |
select count(nest.PRODUCT_ID) into matches from SHOPPING_CARTS carts, table(carts.cart) nest; | |
IF matches > 0 | |
THEN | |
doesExist := true; | |
END IF; | |
RETURN doesExist; | |
END; | |
--https://stackoverflow.com/questions/40124414/dbms-output-cannot-print-boolean | |
BEGIN | |
dbms_output.put_line(sys.diutil.bool_to_int( | |
INCART('100') | |
)); | |
END; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment