Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bobby5892/7c1a2ae4695329f63549a0dc618543fd to your computer and use it in GitHub Desktop.
Save bobby5892/7c1a2ae4695329f63549a0dc618543fd to your computer and use it in GitHub Desktop.
Wk8-in-class-weds
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