Category: PL/SQL

PL/SQL Decode

Oracle PL/SQL Decode Example Select o.id, c.name, o.amount, decode (o.amount, 1200, 'Very Low', 6000, 'Low', 45000,'Good', 60000,'Very Good' ) as decode_example From offers o, customers c Where o.customer_id = c.customer_id Order By 3...

PL/SQL Create Table

Oracle PL/SQL Create Table Create Table Example: create table OFFERS( ID NUMBER(12) not null, CUSTOMER_ID NUMBER(12) not null, PRODUCT_ID NUMBER(4) not null, AMOUNT NUMBER(12,2) not null, CREATE_DATE DATE not null, START_DATE DATE not null, END_DATE DATE not null, DETAILS VARCHAR2(1000), USER_CODE...

PL/SQL Count

Oracle PL/SQL Count Example Count Example 1: SELECT count(c.approve) FROM in_credit c WHERE c.approve='YES' AND c.product_id = (Select p.product_id From products p Where p.description='MORTGAGE' ); Count Example 2: SELECT count(c.customer_id) FROM customers c WHERE c.customer_type = 'COMPANY' AND c.customer_id IN (Select...

Pl/SQL Case

Oracle PL/SQL Case Example Select o.id, u.name, CASE WHEN o.id = '1' THEN 'SALES' WHEN o.id = '2' THEN 'SALES' WHEN o.id = '3' THEN 'SALES' ELSE 'MANAGER' END From offers o, users u Where o.user_code = u.user_code ;...