0% found this document useful (0 votes)
146 views1 page

PLSQL 2

The document provides an example PL/SQL code block to find the total score from a Scores table that is not greater than 100. The Scores table structure contains a single column called Score with a data type of Number(3). The code block uses a cursor to select the sum of all scores from the table that are less than or equal to 100, fetches the result into a variable, and prints the total.

Uploaded by

CSE Linux
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
146 views1 page

PLSQL 2

The document provides an example PL/SQL code block to find the total score from a Scores table that is not greater than 100. The Scores table structure contains a single column called Score with a data type of Number(3). The code block uses a cursor to select the sum of all scores from the table that are less than or equal to 100, fetches the result into a variable, and prints the total.

Uploaded by

CSE Linux
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

12/12/2019 HackerRank

31m
Autocomplete
left Oracle
not
supported
1. Xplore 1- Find total score
ALL 1 SET NULL "NULL"; ⋯
11 declare 
Write a PL/SQL anonymous block to find 12 s Scores.Score%type;
 the summation of all scores in the Score 13 cursor c is select sum(Score) 
table which are  not greater than 100. 14 begin
  15 open c;
1 The structure of the Scores table is as 16 fetch c into s;
below: 17 dbms_output.put_line('Total='
Scores( Score Number(3)); 18 close c;
  19 end;
/

Example: 20 /
If the Scores table has following data 21 exit;
 

Score
 

120
 

30

40

50

150
 
Line: 20 Col: 2
Output : 
Total=120 Test Run Submit
Results Query Code

https://www.hackerrank.com/test/4pbefb37jt2/questions/ghdq3932ods 1/1

You might also like