Parsing from an SQL statement
This SQL statement will give me the results listed in the first table
SELECT Count([Accepts 2].Queue) AS CountOfQueue, Date.Date
FROM [Accepts 2] INNER JOIN [Date] ON FORMAT(Date.Date,"hh")=format([Accepts 2].TimeOfAccept,"hh")
WHERE ((([Accepts 2].TimeOfAccept) Between (#1/1/2002#) And ((#12/30/2002#))))
GROUP BY Date.Date;
I set up a table where I put in the 24 hours
And this query will give you the number of cases per hour per the time specified like this
CountOfQueue Date
1 12:00:00
10 15:00:00
2 16:00:00
1 17:00:00
2 18:00:00
But I want it to give me something like this
Count Of Queue Date
1 12:00:00
0 13:00:00
0 14:00:00
10 15:00:00
2 16:00:00
and so on and so forth all the way up to 23 hundred hours
Do you know the way to modify the query to do this
or how to parse the query resultset to populate the array. For hours that are not returned simply pop a zero into the relevant array position.
THanking you in advance
STEVE
Here's something that I hope will get you started:Map map = new HashMap (); // you could use a tree map if you want to sort the results
for (int i = 0; i < 24; i ++) {
map.put (i + ":00:00", new Integer (0));
ResultSet rs = ...; // your result set
while (rs.next ()) {
map.put (rs.getString ("date"), new Integer (rs.getInt ("count")));
}
Similar Messages
-
How to export the result from executing sql statement to excel file ?
HI all,
Great with Oracle SQL Developer, but I have have a trouble as follwing :
I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
anyone can help me to do that ? Thanks so much
SigmasvnHello Sue,
I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
AddVMOption -Duser.language=en
AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
Regards
Marcus -
High Database server load from expensive SQL statements
Dear all,
I am facing problem in the production sever there is high Database server load from expensive SQL statements as per EVA report
Buffer Load [%] Disk Load [%] CPU Load [%]
55 69 0
Analysis of DB SQL CACHE
EXPENSIVE SQL STATEMENTS OVERVIEW
Object Name CPU Load [%] I/O Load [%] Elapsed Time [%] Executions Records Processed
BSIS 1 9 0 22 90462
CDEF$ 6 6 0 2131113 2575694
BSAD 1 3 0 21 408576
MKPF 1 32 0 180 3899
ICOL$ 9 1 0 2575694 8703798
OBJ$ 6 1 0 3405254 3400023
COL$ 12 0 0 2138793 22919657
MKPF 1 13 0 75 396
MCHB 7 0 0 366543 41708
Please suggest the step by step to reduce the expensive SQL from these table.
RegardsHi,
In tx code ST05 i have find the following deatails.
Duration |Obj. name |Op. |Recs.|RC |Statement
4 TSP03A REOPEN 0 SELECT WHERE "NAME" = 'LOCL' AND "P" = 'S_CLIENTS' 344 TSP03A FETCH 1 0 42 ZRIN DECLARE 0 SELECT WHERE "MANDT" = :A0 AND "BCQ" = :A1 442 ZRIN PREPARE 0 SELECT WHERE "MANDT" = :A0 AND "BCQ" = :A1 3 ZRIN OPEN 0 SELECT WHERE "MANDT" = '600' AND "BCQ" = 'BCQ'
2,181,565 ZRIN FETCH 4 1403
706,267 DBA_SEGME FETCH 99 0 8,248 DBA_SEGME FETCH 99 0 44,994 DBA_SEGME FETCH 99 0 67,713 DBA_SEGME FETCH 99 0
1,367,923 DBA_SEGME FETCH 99 0
16,735|TADIR |FETCH | 1| 1403| |
5
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CME__TEXT'
22,415
TADIR
FETCH
1
1403
4
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CME_PATTERN_SIGN'
232
TADIR
FETCH
1
1403
4
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CML_ARC_DEADLINE'
19,189
TADIR
FETCH
1
1403
4
TADIR
REOPEN
706,267
DBA_SEGME
FETCH
99
0
|
44,994
DBA_SEGME
FETCH
99
0
67,713
DBA_SEGME
FETCH
99
0
Please suggest how to reduce it.
Regards, -
RMAN-11003: failure during parse/execution of SQL statement: alter session
without doing any changes I have started getting the following error in the RMAN logs.
i didnt any changes related to sort_area_size but getting the error below
plz help guys
RMAN logs
=====================
connected to recovery catalog database
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of allocate command at 12/03/2007 22:00:01
RMAN-03014: implicit resync of recovery catalog failed
RMAN-03009: failure of full resync command on default channel at 12/03/2007 22:00:01
RMAN-11003: failure during parse/execution of SQL statement: alter session set sort_area_size=10485760
ORA-00068: invalid value 10485760 for parameter sort_area_size, must be between 0 and 1Hi:
It seems when you are starting RMAN it's executing some commands (one 'ALTER SESSION...'. It's seems to be a batch which has a bad value for SORT_AREA_SIZE. Find it and modify to a proper value as message shows. If you can't find start RMAN by calling directly the executable ($ORACLE_HOME/bin/rman or %ORACLE_HOME%/bin/rman.exe). -
Different result from same SQL statement
The following SQL statement brings back records using query
analyzer on the SQL server. However when I run it in a cold fusion
page it comes back with no results. Any idea why????????
SELECT COUNT(h.userID) AS hits, u.OCD
FROM dbo.tbl_hits h INNER JOIN
dbo.tlkp_users u ON h.userID = u.PIN
WHERE (h.appName LIKE 'OPwiz%') AND (h.lu_date BETWEEN
'05/01/07' AND '06/01/07')
GROUP BY u.OCD
ORDER BY u.OCDAnthony Spears wrote:
> That didn't work either.
>
> But here is something interesting. If we use the dates
05/01/2007 and
> 06/01/2007 we get results in SQL Server Query Analyzer
but not using a cold
> fusion page. But if we use the dates 05/01/2007 and
09/01/2007 both get back
> the same results.
>
Are you absolutely, 100% sure that you are connecting to the
same
database instance with both CF and Query Analyzer? That kind
of symptom
is 9 out of 10 times because the user is looking at different
data. One
is looking at production and the other development or an
backup or
recent copy or something different. -
Output fields dynamically from an SQL statement
I'm trying to build an SQL statement that uses the values from one table to form the field names to output in the select statement. I have two tables, pjl_test contains the field names and bp_objects contains the data I want the sql to return... the tables look like this:
pjl_test table:
field_name
OBJECT_TYPE
SHORT_DESCRIPTION
OBJECT_ID
bp_objects table:
object_id, object_type, short_description
275 TS Establish Contract
276 TS Enter contract details
277 TS Review & amend Contract details as required
278 TS Enter/update contractor details
The select statement I'm toying with looks like this:
SELECT (
SELECT field_name
from (SELECT ROWNUM as MyNo, field_name from pjl_test)
where myno = 1) as Name FROM BP_OBJECTS
The problem is that the sql is using the returned field name as a display value instead of a column name and thus outputs the following:
OBJECT_TYPE
OBJECT_TYPE
OBJECT_TYPE
OBJECT_TYPE
I'm sure there must be a way to do this in an single sql statement, is anyone able to advise.
Thanks in advanceI'm sure there must be a way to do this in an single sql statement, is anyone able to advise.No, there is no simple way to get the column name then select those ones in one statement.
Dynamic sql will do that. But not a single statement.
Or maybe some XML package. Then you have to tell about your db vwersion.
Nicolas. -
From 10g, "SQL Statement Length" description disappeared....
http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10755/limits003.htm#sthref3594
From 10g, on the above 'Logical Database Limits' section of 'Reference' document, the description for 'SQL Statement Length' limitation (64K) has been dropped.
Is this mean there is NO limitation on 10g or just mistake?Hi Tadaaki,
Apologies for the delay in responding to you.
Unfortunately I cannot answer this question. Although my group maintains the Documentation pages on OTN, we are not part of OTN, nor do we have input with regard to the content of documentation. We merely provide links to the documentation at: http://www.oracle.com/technology/documentation/index.html
Please try the Members Feedback Forum at: Community Feedback (No Product Questions)
Thanks and regards,
Les -
Spooling Extracts from Multiple SQL statements in 1 File
Hi all,
I am trying to spool extract results of 3 separate SQL statements into one single file. I wrote a SQL block similar to the one below. However, the result of the statements overwrite each other: 3 overwrote 2 and overwrote 1. Any suggestion how to combined there extracted results in one file?
spool c:\test.txt
<SQL statement 1>
<SQL statement 2>
<SQL statement 3>
/spool OFF
Thanks in advance
JasonPlease paste you SQL file here. These is no way one should overwrite another.
Eric -
Invalid identifier results from an sql statement in php
hello there, i'm trying to access data from an oracle 11g database via oci and php 5.3.8.
i'm getting the ORA-00904 (invalid identifier) error when executing the following statement:
$stid = oci_parse($conn, 'select * from table1 where column1 = "XYZ"');
when i do this:
$searchstring = "XYZ";
$stid = oci_parse($conn, 'select * from table1 where column1 = '.$searchstring.'');
i'm getting this error:
ORA-00933: SQL command not properly ended
column1 is varchar2, the entries are either letters and numbers (never only numbers) or empty.
when i do this:
$stid = oci_parse($conn, 'select * from table1');
i'm getting the data and there are entries in column1 with XYZ.
has anyone an idea, what i do wrong?
regards jThe PHP forum for questions like this is at http://www.oracle.com/technetwork/forums/php/index.html
You really need to be using a bind variable here. Otherwise you will likely suffer from poor DB performance, and also open yourself to SQL Injection security attacks. Try:
$stid = oci_parse($conn, 'select * from table1 where column1 = :bv');
oci_bind_by_name($stid, ":bv", $searchstring);Regarding quoting of your example try:
$searchstring = "XYZ";
echo 'select * from table1 where column1 = '.$searchstring.'';Then run that SQL in SQL*Plus and watch it fail. What you need is given with:
echo 'select * from table1 where column1 = \''.$searchstring.'\'';See the bottom of p 126 of The Underground PHP and Oracle Manual
Note that with the bind variable example you didn't need quotes around :bv. -
Odd results from SQL statement in JSP
Hi.
Getting very strange results from my SQL statement housed in my JSP.
the last part of it is like so:
"SELECT DISTINCT AID, ACTIVE, REQUESTOR_NAME, ..." +
"REQUESTOR_EMAIL" +
" FROM CHANGE_CONTROL_ADMIN a INNER JOIN CHANGE_CONTROL_USER b " +
"ON a.CHANGE_CTRL_ID = b.CHANGE_CTRL_ID " +
" WHERE UPPER(REQUESTOR_NAME) LIKE ? "; I've set the following variables and statements:
String reqName = request.getParameter("requestor_name");
PreparedStatement prepstmt = connection.prepareStatement(preparedQuery);
prepstmt.setString(1, "%" + reqName.trim().toUpperCase() + "%");
ResultSet rslts = prepstmt.executeQuery();
rslts.next();
int aidn = rslts.getInt(1);
int actbox = rslts.getInt(2); String reqname = rslts.getString(3).toUpperCase();
String reqemails = rslts.getString(4);
String bizct = rslts.getString(5);
String dept = rslts.getString(6);
String loc = rslts.getString(7);
Date datereq = rslts.getDate(8);
String busvp = rslts.getString(9);
AND SO ONSo then I loop it, or try to with the following:
<%
try {
while ((rslts).next()) { %>
<tr class="style17">
<td><%=reqname%></td><td><%=reqemails %></td><td><%=bizct %></td>td><%=dept %></td>
<td><%=aidn %></td>
</tr>
<%
rslts.close();
selstmt.close();
catch(Exception ex){
ex.printStackTrace();
log("Exception", ex);
%>AND so on, setting 13 getXXX methods of the 16 cols in the SQL statement.
Trouble is I'm getting wildly inconsistent results.
For example, typing 'H' (w/o quotes) will spit out 20 duplicate records of a guy named Herman, with the rest of his corresponding info correct, just repeated for some reason.
Typing in 'He' will bring back the record twice (2 rows of the complete result set being queried).
However, typing in 'Her' returns nothing. I could type in 'ell' (last 3 letters of his name, Winchell) and it will again return two duplicate records, but typing in 'hell' would return nothing.
Am I omitting something crucial from the while statement that's needed to accurately print out the results set without duplicating it and that will ensure returning it?
There's also records in the DB that I know are there but aren't being returned. Different names (i.e. Jennifer, Jesse, Jeremy) won't be returned by typing in partial name strings like Je.
Any insight would be largely appreciated.
One sidenote: I can go to SQL Plus and accurately return a results set through the above query. Having said that, is it possible the JDBC driver has some kind of issue?
Message was edited by:
bpropes20
Message was edited by:
bpropes20Am I omitting something crucial from the while
statement that's needed to accurately print out the
results set without duplicating it and that will
ensure returning it?Yes.
In this code, nothing ever changes the value of reqname or any of the other variables.
while ((rslts).next()) { %>
<tr class="style17">
<td><%=reqname%></td><td><%=reqemails %></td><td><%=bizct %></td>td><%=dept %></td>
<td><%=aidn %></td>
</tr>
<%
} You code needs to be like this:while (rslts.next()) {
reqname = rslts.getString(3).toUpperCase();
reqemails = rslts.getString(4);
bizct = rslts.getString(5);
dept = rslts.getString(6);
loc = rslts.getString(7);
datereq = rslts.getDate(8);
busvp = rslts.getString(9);
%>
<tr class="style17">
<td><%=reqname%></td><td><%=reqemails %></td><td><%=bizct %></td>td><%=dept %></td>
<td><%=aidn %></td>
</tr>
<%
There's also records in the DB that I know are there
but aren't being returned. Different names (i.e.
Jennifer, Jesse, Jeremy) won't be returned by typing
in partial name strings like Je.Well, you're half-right, your loop won't display all the rows in the result set, because you call rslts.next(); once immediately after executing the query. That advance the result set to the first row; when the loop is entered, it starts displaying at the 2nd row (or later if there are more next() calls in the code you omitted). -
Precompiled SQL statement at client side ? (JDBC)
Hi,
Will Oracle support precompiled SQL statement for jdbc client ?
ThanksA pre-compiled SQL statement on the client side makes absolutely no sense. Let's say the statement refers to system object id 1234 - the EMP table. But in the meantime the EMP table has been dropped and re-created as an index organised table and is now object id 7890.
What about issues like scope, cost-based optimisation, etc?
It honestly does not make the slightest sense to even want such a "pre-compiled client SQL" feature.
> hmm.... Is there anyway to return the compiled SQL
from database ?
Yes - that is exactly what a cursor handle is. You give the database a SQL statement. It parses that and returns a SQL (aka cursor) handle for you to use and re-use.
The typical (stateful) client would use the following template:
-- open a database connection (usually returns a connection/session handle)
hConnection = open DBconnection(params)
-- parse/prepare a SQL statement (returns a SQL/cursor handle)
hSQL = parseSQL( hConnection, 'INSERT INTO foo VALUES( :0, :1 )' )
-- reuse the SQL statement
while (Some_Condition)
loop
Some_Processing()
-- bind values to the SQL statement variables
SQLBind( hSQL, '0', var1)
SQLBind( hSQL, '1', var2)
-- execute the statement (it is not compiled or parsed again by the database)
ExecSQL( hSQL )
endloop -
Send byte array argeument from pl/sql to java stored procedure?
I have a java method that accepts an argument of type byte[].
I want to define a call specification so that it can invoked from a sql statement.
The Java Developer's Guide show how to map SQL data types to java types and classes, but it is unclear if I can map a SQL data type to an array.
Does anyone know which SQL type to use to map to a byte array?
I'm using Oracle 10.2, thus jvm 1.4.2.As soon as I posted this question, I saw the RAW to byte[] mapping listed in the documentation. How did I overlook it? Anyway, that what I needed.
-
Hi,
From the SQL statement below, i need help in explaining what does the line "WHERE ( lims_sys.result.result_template_id = lims_sys.result_template_limit.result_template_id (+))" do?
This statement was written by a vendor and now i have problem displaying some new data. Only a portion of what i need is displayed.
SELECT "LIMS_SYS"."RESULT"."DESCRIPTION",
"LIMS_SYS"."RESULT_TEMPLATE_LIMIT"."NUMERIC_LIMIT",
"LIMS_SYS"."RESULT"."FORMATTED_RESULT",
"LIMS_SYS"."RESULT"."CONCLUSION",
"LIMS_SYS"."RESULT_USER"."U_RESULT_SEQUENCE" ,
"LIMS_SYS"."RESULT"."RESULT_ID"
FROM "LIMS_SYS"."RESULT",
"LIMS_SYS"."RESULT_TEMPLATE_LIMIT",
"LIMS_SYS"."RESULT_USER",
"LIMS_SYS"."ALIQUOT",
"LIMS_SYS"."SAMPLE",
"LIMS_SYS"."SDG",
"LIMS_SYS"."TEST"
WHERE ( lims_sys.result.result_template_id = lims_sys.result_template_limit.result_template_id (+)) and
( "LIMS_SYS"."RESULT"."RESULT_ID" = "LIMS_SYS"."RESULT_USER"."RESULT_ID" ) and
( "LIMS_SYS"."SDG"."SDG_ID" = "LIMS_SYS"."SAMPLE"."SDG_ID" ) and
( "LIMS_SYS"."SAMPLE"."SAMPLE_ID" = "LIMS_SYS"."ALIQUOT"."SAMPLE_ID" ) and
( "LIMS_SYS"."ALIQUOT"."ALIQUOT_ID" = "LIMS_SYS"."TEST"."ALIQUOT_ID" ) and
( "LIMS_SYS"."TEST"."TEST_ID" = "LIMS_SYS"."RESULT"."TEST_ID" ) and
( ( LIMS_SYS."SDG"."SDG_ID" = :sdg_id ) AND
( LIMS_SYS."RESULT"."STATUS" <> 'X' ) AND
( LIMS_SYS."RESULT"."REPORTED" = 'T' ) AND
( LIMS_SYS."RESULT_USER"."U_RESULT_CATEGORY" in ( 'Metal' , 'Mean Metal', 'Range Metal')) )
Thanks for all your help.Hi,
After WHERE .......... is indicates an OUTER Join condition.
In this type of join, system retrieves the data for matched and
as well as unmatched.
Example:
EMP table have a column DEPTNO with the data 10, 20, 30 (total rows=14)
DEPT table have a column DEPTNO with the data 10, 20, 30, 40, 50 (total rows=5)
If the WHERE clause contained EMP.DEPTNO(+) = DEPT.DEPTNO
then the output contain the data relative to 10, 20, 30, 40, 50 (total rows = 16)
i.e. 14 rows (with matching data) and 2 rows (with unmatching data)
Regards,
Sailaja -
Query SQL Statement & Update SQL Statement
Hi!
I configure the JDBC adapter sender (XI) to take data from MSSQL database.
I have to run select like this:
SELECT
tblMilestone.Site,
tblMilestone.Revision,
tblMilestone.MilestoneNameID,
tblMilestone.ApprovedDate,
tblMilestoneName.MilestoneName
FROM
tblMilestoneName
INNER JOIN tblMilestone ON tblMilestoneName.MilestoneNameID = tblMilestone.MilestoneNameID
WHERE tblMilestone.StatusCode = 1;
My question is what "Update SQL Statement" I should use in communication channel definition? I only need to update tblMilestone or this two tables?
Maybe you give me some example.Check this from SAP help...
Update SQL Statement
You have the following options:
● Enter a valid SQL statement that is to be applied to the database once the data (determined from the Query SQL Statement) has been successfully sent to the Integration Server/PCK.
It must be an INSERT, UPDATE, or DELETE statement.
● In place of the SQL statement, you can also enter <TEST>. Once the data determined from Query SQL Statement has been successfully sent, the data in the database remains unaltered.
This is recommended if the data has not only been read, but also changed by a stored procedure entered under Query SQL Statement. -
PL/SQL how to loop thru SQL statement?
Hey guys. I have this bit of a complicated problem.
I have a cursor that selects a DISTINCT field called Term and a StudentID.
I am looping thru that cursor.
Inside that loop I have another SQL statement that is pulling all rows from the DB where the Term = the Term and the StudentID= the StudentID from the crusor loop.
My problem is how do I get all the information/rows returned from that SQL statement? I need to loop thru it somehow, but I am not sure how to do it.
If there is a better way to get this done feel free to chime in.
Here is my code.
/* CURSOR*/
CURSOR c_GPAPerTerm IS
SELECT DISTINCT Term, Student_ID FROM course_grades
WHERE STUDENT_ID = p_StudentID;
/* OPEN AND LOOP THRU CURSOR*/
OPEN c_GPAPerTerm;
LOOP
FETCH c_GPAPerTerm INTO v_Terms,v_StudentID;
/* SQL STATEMENT NEED TO LOOP THRU AND GET VALUES FOR EACH ROW*/
SELECT Score
INTO v_Scores
FROM course_grades
WHERE Term = v_Terms and StudentID = v_StudentID;
EXIT WHEN c_GPAPerTerm%NOTFOUND;
END LOOP;
CLOSE c_GPAPerTerm;Ok here's my complete code....it's pretty big though...hope it's not too confusing.
It compiles fine if I take the new cursor out, so the error is somewhere in that cursor.
CREATE OR REPLACE PROCEDURE get_Student_GPA(p_StudentID IN NUMBER) AS
/*VARIABLES*/
v_Terms VARCHAR2(6);
v_Courses VARCHAR2(6);
v_Scores NUMBER;
v_Grade CHAR;
v_GPA NUMBER;
v_ScoresTotal NUMBER :=0;
v_StudentID NUMBER;
/*CURSORS*/
CURSOR c_GetTerms IS
SELECT Term
FROM course_grades
WHERE STUDENT_ID = p_StudentID;
CURSOR c_GetCourseAndGrade IS
SELECT Course_ID, Score FROM course_grades
WHERE STUDENT_ID = p_StudentID;
CURSOR c_GPAPerTerm IS
SELECT DISTINCT Term, Student_ID
FROM course_grades
WHERE STUDENT_ID = p_StudentID;
CURSOR c_GetScores (p_Term VARCHAR2, p_StudentID NUMBER) IS
SELECT Score
FROM course_grades
WHERE Term = p_Term AND StudentID = p_StudentID;
/*FUNCTIONS*/
FUNCTION convert_grade(p_GradeNumber IN NUMBER)
RETURN CHAR IS
BEGIN
/* GET NUMERIC GRADE AND CONVERT TO LETTER */
CASE
WHEN p_GradeNumber < 60 THEN RETURN 'F';
WHEN (p_GradeNumber > 59 AND p_GradeNumber < 70) THEN RETURN 'D';
WHEN (p_GradeNumber > 69 AND p_GradeNumber < 80) THEN RETURN 'C';
WHEN (p_GradeNumber > 79 AND p_GradeNumber < 90) THEN RETURN 'B';
WHEN (p_GradeNumber > 89 AND p_GradeNumber < 101) THEN RETURN 'A';
ELSE RETURN 'Z';
END CASE;
END convert_grade;
FUNCTION calculate_gpa(p_TotalHourPoints IN NUMBER, p_TotalHours IN NUMBER)
RETURN NUMBER IS
/*CREATE VARIABLE TO HOLD GPA*/
v_GPA NUMBER;
BEGIN
/*CALCULATE AND OUTPUT GPA*/
v_GPA := p_TotalHourPoints/p_TotalHours;
RETURN v_GPA;
END calculate_gpa;
FUNCTION calculate_point (p_Grade IN CHAR)
RETURN NUMBER IS
BEGIN
/* GET LETTER GRADE AND CONVERT TO NUMBER */
CASE
WHEN p_Grade = 'A' THEN RETURN 4;
WHEN p_Grade = 'B' THEN RETURN 3;
WHEN p_Grade = 'C' THEN RETURN 2;
WHEN p_Grade = 'D' THEN RETURN 1;
WHEN p_Grade = 'F' THEN RETURN 0;
ELSE RETURN 0;
END CASE;
END calculate_point ;
/****BEGIN MAIN BLOCK********/
BEGIN
DBMS_OUTPUT.PUT_LINE('**********TERMS**********');
OPEN c_GetTerms;
LOOP
FETCH c_GetTerms INTO v_Terms;
DBMS_OUTPUT.PUT_LINE('Term: ' || v_Terms);
EXIT WHEN c_GetTerms%NOTFOUND;
END LOOP;
CLOSE c_GetTerms;
DBMS_OUTPUT.PUT_LINE('**********COURSES AND GRADES**********');
OPEN c_GetCourseAndGrade;
LOOP
FETCH c_GetCourseAndGrade INTO v_Courses, v_Scores;
v_Grade := convert_grade(v_Scores);
DBMS_OUTPUT.PUT_LINE('Course: ' || v_Courses || ' Grade: ' || v_Grade);
EXIT WHEN c_GetCourseAndGrade%NOTFOUND;
END LOOP;
CLOSE c_GetCourseAndGrade;
DBMS_OUTPUT.PUT_LINE('**********GPA PER TERM**********');
OPEN c_GPAPerTerm;
LOOP
FETCH c_GPAPerTerm INTO v_Terms,v_StudentID;
/*NEW CURSOR LOOP WILL GO HERE*/
v_ScoresTotal := v_ScoresTotal + v_Scores;
v_GPA := calculate_gpa(v_ScoresTotal, 3);
v_ScoresTotal :=0;
DBMS_OUTPUT.PUT_LINE('Term: ' || v_Terms || ' GPA: ' || v_GPA);
EXIT WHEN c_GPAPerTerm%NOTFOUND;
END LOOP;
CLOSE c_GPAPerTerm;
END get_Student_GPA;
/
Maybe you are looking for
-
Why the video playback stotter but audio is ok and all system resources are ok as well?
Hi, I'm using Premiere Elements 12 and prepared a project using m2ts files of my sony camera. When I started the project, everything was find, editing easy. Now, some months later I wanted to finish the project on the same laptop ( Intel Cor i5-4200
-
Calling Webdynpro Java Application from Webdynpro ABAP Application.
Hi, We have developed one Application using Webdynpro Java and I m in need to call the Webdynpro Java application from Webdynpro ABAP. Require Suggestions to acheive this. Thanks In advance. Reg, Ajay.
-
Complex Restrictions in Select-options
Hi Team, I've coded SELECT-OPTIONS in my web dynpro(ABAP) and want to disable the complex selection button/link (displayed just before the actual field). This link takes the user to either "Exclude" the selection or other options like "GE", "BT" etc.
-
Hello, I setup my brand new Time Capsule today. But using my Airport utility In Mountain Lion I don't see manual or advanced setup when I click Base Station in the menu. I download the windows version and there I see the options. I want to see the l
-
I tried to download the free IE version 9 available with yahoo as my home page(because it's easier for me to use.) It said my computer won't except that version but will take the Micro soft version 8, so I downloaded it that way. Now the home page wo