SLIS A-Z Index
People Search
SLIS Calendar

Programs

Courses

Textbooks by Semester

Course Web Pages - Spring 2012 - LIBR 242-01/10 Greensheet - Sample Codes - SQL+ Scripting

Sample of Scripting (Procedure) in Oracle's SQL+



create or replace procedure overdue_notice (book_ident char,
					borrower_ident char,
					book_auth char,
					book_title char,
					was_due date)
  as

  /*---------------------- BEGIN --------------------------- */

begin
  declare
	temp_buffer char (1);		/* dummy variable */
	cursor myCursor is
		select ` ` from overdue_notes
		where	(book_id	= book_ident     AND
			borrower_id	= borrower_ident AND
			due_date	= was_due);
  begin
	open myCursor;
	fetch myCursor into temp_buffer;
	if (myCursor%found) then NULL;	/* already there. do nothing */
	else				/* not found. insert the record */
		insert into overdue_notes
			values(book_ident, book_auth, borrow_ident,
			    book_title, was_due, sysdate, user);
	end if;
  end;
end;
/




Select here to return to the sample codes page.