SQL Reports

Test-1 compute the sum of a column in Oracle SQL?

SQL> create table testsumrpt
2 (name varchar2(25),
3 mark number);

Table created.

SQL> insert into testsumrpt
2 values(‘&1’,&2
3 );
Enter value for 1: Shiv
Enter value for 2: 100
old 2: values(‘&1’,&2
new 2: values(‘Shiv’,100

1 row created.

SQL> /
Enter value for 1: Hitesh
Enter value for 2: 50
old 2: values(‘&1’,&2
new 2: values(‘Hitesh’,50

1 row created.

SQL> /
Enter value for 1: Kalpesh
Enter value for 2: 98
old 2: values(‘&1’,&2
new 2: values(‘Kalpesh’,98

1 row created.

SQL> commit
2 /

Commit complete.

SQL> select * from testsumrpt;

NAME MARK
————————- ———-
Shiv 100
Hitesh 50
Kalpesh 98

SQL> COLUMN dummy NOPRINT
SQL> COMPUTE SUM OF "mark" ON REPORT
SQL> BREAK ON REPORT
SQL> select * from testsumrpt;

NAME                           MARK
------------------------- ----------
Shiv                        100
Hitesh                       50
Kalpesh                      98
                          ----------
sum                         248

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.