工作单(oracle)

chenxiuju 2003-01-22 05:34:30
为什么我在工作单中写入过程后,不管写入什么语句后,工作单都不响应?
...全文
17 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
developer2002 2003-01-22
  • 打赏
  • 举报
回复
换一个第三方工具,会让你的开发工作事半功倍!
不用再讨论oracle的破工作单该如何用了。
Fred_Mark 2003-01-22
  • 打赏
  • 举报
回复
同意,下午我也找了半天这个东东。:)
CREATE OR REPLACE FUNCTION CountCredits (
/* Returns the number of credits for which the student
identified by p_StudentID is currently registered */
p_StudentID IN students.ID%TYPE)
RETURN NUMBER AS

v_TotalCredits NUMBER; -- Total number of credits
v_CourseCredits NUMBER; -- Credits for one course
CURSOR c_RegisteredCourses IS
SELECT department, course
FROM registered_students
WHERE student_id = p_StudentID;
BEGIN
Debug.Reset;
Debug.Debug('Before loop, v_TotalCredits', v_TotalCredits);
FOR v_CourseRec IN c_RegisteredCourses LOOP
-- Determine the credits for this class.
SELECT num_credits
INTO v_CourseCredits
FROM classes
WHERE department = v_CourseRec.department
AND course = v_CourseRec.course;

Debug.Debug('Inside loop, v_CourseCredits', v_CourseCredits);
-- Add it to the total so far.
v_TotalCredits := v_TotalCredits + v_CourseCredits;
Debug.Debug('Inside loop, v_TotalCredits', v_TotalCredits);
END LOOP;

Debug.Debug('After loop, returning', v_TotalCredits);
RETURN v_TotalCredits;
END CountCredits;
/
beckhambobo 2003-01-22
  • 打赏
  • 举报
回复
要在最后一行加一个"/"符号.

declare
...
begin
...
end;
/

17,377

社区成员

发帖
与我相关
我的任务
社区描述
Oracle 基础和管理
社区管理员
  • 基础和管理社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧