add remove split language show hidden hide
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
BANNER
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
6 rows affected
CITY CODE QTY
aaa 101 10
bbb 101 20
aaa 102 30
bbb 102 40
aaa 103 50
bbb 103 60
CITY '101' '102' '103'
aaa 10 30 50
bbb 20 40 60
1 rows affected
ORA-00936: missing expression
1 rows affected

dbms_output:
stmt=
        select * from (
            select city, code, qty
            from t1)
        pivot (sum (qty) for code in ('101' "101",'102' "102",'103' "103",'104' "104"))
CITY 101 102 103 104
aaa 10 30 50 40
bbb 20 40 60 null