slides11 - Schedule Today: Feb. 7 (TH) x x PL/SQL, Embedded...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Winter 2002 Arthur Keller – CS 180 11–1 Schedule Today: Feb. 7 (TH) PL/SQL, Embedded SQL, CLI, JDBC. Read Sections 8.1, 8.3-8.5. Feb. 12 (T) Advising Day. No class. Reminder: Midterm is Feb. 14 (TH) Covers material through Feb. 7 (TH) lecture and readings (Chapters 1-3, 5-7, 8.1-8.5). Feb. 19 (T) Object-Relational Systems. Read Sections 4.5, 9.4-9.5. Assignment 5 due. Feb. 21 (TH) Transactions, Authorization. Read Sections 8.6-8.7. Project Part 5 due.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Winter 2002 Arthur Keller – CS 180 11–2 Embedded SQL Add to a conventional programming language (C in our examples) certain statements that represent SQL operations. Each embedded SQL statement introduced with EXEC SQL . Preprocessor converts C + SQL to pure C. SQL statements become procedure calls.
Background image of page 2
Winter 2002 Arthur Keller – CS 180 11–3 Shared Variables A special place for C declarations of variables that are accessible to both SQL and C. Bracketed by EXEC SQL BEGIN/END DECLARE SECTION; In Oracle Pro/C (not C++) the “brackets” are optional. In C, variables used normally; in SQL, they must be preceded by a colon.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Winter 2002 Arthur Keller – CS 180 11–4 Example Find the price for a given beer at a given bar. Sells(bar , beer , price) EXEC SQL BEGIN DECLARE SECTION; char theBar[21], theBeer[21]; float thePrice; EXEC SQL END DECLARE SECTION; . . . /* assign to theBar and theBeer */ . . . EXEC SQL SELECT price INTO :thePrice FROM Sells WHERE beer = :theBeer AND bar = :theBar; . . .
Background image of page 4
Winter 2002 Arthur Keller – CS 180 11–5 Cursors Similar to PL/SQL cursors, with some syntactic differences. Example
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 14

slides11 - Schedule Today: Feb. 7 (TH) x x PL/SQL, Embedded...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online