Inserting SQL into HLL programs

Slides:



Advertisements
Similar presentations
Embedded SQL (Cont.) Pertemuan 10 Matakuliah: T0413/Current Popular IT II Tahun: 2007.
Advertisements

COBOL Considerations Identification Division. Environment Division
Embedded SQL John Ortiz. Lecture 15Embedded SQL2 Why Isn’t Interactive SQL Enough?  How to do this using interactive SQL?  Print a well-formatted transcript.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Introduction to SQL Programming Techniques.
1 Minggu 6, Pertemuan 11 Programmatic SQL Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
Murali Mani SQL with other Programming Languages.
End of SQL: Triggers, Impedance Mismatch and Transactions February 6 th, 2004.
Chapter 7 Advanced SQL Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Dec 11, 2003Murali Mani SQL with other Programming Languages B term 2004: lecture 16.
A Guide to SQL, Seventh Edition. Objectives Embed SQL commands in PL/SQL programs Retrieve single rows using embedded SQL Update a table using embedded.
Where Do We Start? How Do We Debug? Sources of Debug Information –CICS Transaction Abends –Batch Abend Codes –System Codes –Message Logs –DB2 SQL Codes.
DB2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/DB01/003 Version No:2.0a Session Plan SPUFI Hands On Introduction to Embedded SQL DCLGEN.
Jump-Start Embedded SQL into RPG Presented by: Robert Arce.
Introduction to PL/SQL. Procedural Language extension for SQL Oracle Proprietary 3GL Capabilities Integration of SQL Portable within Oracle data bases.
Agenda Journalling More Embedded SQL. Journalling.
Overview of JDBC and Pro*C 1 Overview of JDBC,Pro*C and Oracle connectivity on Omega CSE 5330 – Database Systems.
CICS-Prg1 Terminal Handling CURSOR Positioning (in SEND MAP) IC option in DFHMDF Macro (ATTRB Parm)  If more than one – LAST position is used. DIRECT.
1 No class Thurs. Oct. 2 E-day Exam 1 Thurs. Oct. 9 HW3 Oct. 2 to –Available Oct 2 only until 2 pm.
4B-1 Wei-Pang Yang, Information Management, NDHU Introduction to Database CHAPTER 4B ( 補 ) DB2 and SQL  Overview  Data Definition  Data Manipulation.
Module 1: Introduction to Transact-SQL
©Silberschatz, Korth and Sudarshan4.1Database System Concepts Modification of the Database – Deletion Delete all tuples from the loan relation. delete.
A Free sample background from © 2006 By Default! R.SARAVANA KUMAR S.NAVEEN Relational Database Model.
Overview of JDBC and Pro*C 1 CSE 5330 – Database Systems.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
Converting To Anthony Tichonoff Florida Hospital MIS January 2007 With Ease Multi-Row Fetch.
Overview · What is PL/SQL · Advantages of PL/SQL · Basic Structure of a PL/SQL Block · Procedure · Function · Anonymous Block · Types of Block · Declaring.
CpSc 462/662: Database Management Systems (DBMS) (TEXNH Approach) Stored Procedure James Wang.
Stored Procedures Week 9. Test Details Stored Procedures SQL can call code written in iSeries High Level Languages –Called stored procedures SQL has.
Recap of SQL Lab no 8 Advance Database Management System.
Just a Little PHP Programming PHP on the Server. Common Programming Language Features Comments Data Types Variable Declarations Expressions Flow of Control.
Programmatic SQL Shaista Khan CS 157B. Topic Embedded SQL statements in high-level programming languages.
SQL Jan 20,2014. DBMS Stores data as records, tables etc. Accepts data and stores that data for later use Uses query languages for searching, sorting,
Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Chapter 4: SQL Complex Queries Complex Queries Views Views Modification of the Database Modification of the Database Joined Relations Joined Relations.
Application Program Design Day3. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/TP01/003 Version No: 1.0 Objectives Basic CICS programming –Structure.
Dr Gordon Russell, Napier University Unit Embedde SQL - V2.0 1 Embedded SQL Unit 5.1.
Chapter 4 An Introduction to SQL. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.4-2 Topics in this Chapter SQL: History and Overview The.
1 Pertemuan > > Matakuliah: >/ > Tahun: > Versi: >
A Guide to SQL, Eighth Edition Chapter Eight SQL Functions and Procedures.
Different Constraint Types Type Where Declared When activated Guaranteed to hold? Attribute with attribute on insertion not if CHECK or update subquery.
Chapter 8 Embedded SQL.
Oracle11g: PL/SQL Programming Chapter 3 Handling Data in PL/SQL Blocks.
In this module, we will design a program to work with the PROJECT table, learning to insert a new project into the table, to delete one or more projects.
© 2007 by Prentice Hall2-1 Introduction to Oracle 10g Chapter 2 Overview of SQL and SQL*Plus James Perry and Gerald Post.
Constraining Attribute Values Constrain invalid values –NOT NULL –gender CHAR(1) CHECK (gender IN (‘F’, ‘M’)) –MovieName CHAR(30) CHECK (MovieName IN (SELECT.
SCU Fall 2002JoAnne Holliday10–1 Schedule Today u Triggers, Procedures, PL/SQL. u Read Sections , 8.1, 8.5. Next u Transaction concepts, security.
Oracle & SQL. Oracle Data Types Character Data Types: Char(2) Varchar (20) Clob: large character string as long as 4GB Bolb and bfile: large amount of.
Basic SQL*Plus edit and execute commands SQL*Plus buffer and built-in editor holds the last SQL statement Statements are created in free-flow style and.
1 Stored Procedures in MySQL Part I. 2 Objectives SQL Vs. MySQL SP MySQL SP Parameters MySQL SP Control Structures.
Introduction to PL/SQL Francis Thottungal. The outline The basic PL/SQL code structure is : DECLARE -- optional, which declares and define variables,
Lu Wei1 Outline Introduction Basic SQL Setting Up and Using PostgreSQL Advanced SQL Embeded SQL.
RETRIEVE A NO. OF ROWS ¦ Declare a cursor ¦ Open the cursor ¦ Fetch rows of data ¦ Stop fetching rows ¦ Close the cursor.
1 Section 10 - Embedded SQL u Many computer languages allow you to embed SQL statements within the code (e.g. COBOL, PowerBuilder, C++, PL/SQL, etc.) u.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
Chapter 4 An Introduction to SQL. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.4-2 Topics in this Chapter SQL: History and Overview The.
Concepts of Database Management, Fifth Edition Chapter 3: The Relational Model 2: SQL.
SCU Fall 2002JoAnne Holliday10–1 Schedule Today u Embedded SQL. u Read Sections 8.1, 8.5. Next u Transaction concepts, security u Read Sections 8.6 – 8.7.
Chapter 4 An Introduction to SQL.
A Guide to SQL, Seventh Edition
© 2016, Mike Murach & Associates, Inc.
Chapter 5: Advanced SQL Database System concepts,6th Ed.
Introduction to Database
PL/SQL Programing : Triggers
Introduction to Database
Embedded DB2.
Unit I-2.
Dynamic SQL The dynamic SQL component of SQL allows programs to construct and submit SQL queries at run time. In contrast, embedded SQL statements must.
Handling Data in PL/SQL Blocks
Presentation transcript:

Inserting SQL into HLL programs Embedded SQL Inserting SQL into HLL programs

SQL Data Types in Cobol SQL Cobol Definition Char(length) Pic X(length). VarChar(max-length) 01 variable-name. 49 string-length pic S9(4) Binary. 49 string-identifier pic X(max-length). Dec(precision, scale) Pic 9(precision-scale)V(scale) packed-decimal. Numeric(precision, scale) SmallInt Pic S9(4) Binary Int Pic S9(9) Binary

SQL Data Types in Cobol SQL Cobol Definition SmallInt Pic S9(4) Binary Date Format of date Time Format of time Timestamp Format of timestamp

SQL Communication Area Includes the SQLState variable 5 characters – used to communicate what happened after an SQL statement executes ‘00000’ – no warning or exception ‘02000’ – no row found ’01xxx’ – warning Yyxxx – error Where yy is not 00, 01 or 02

Coding SQL statements Exec SQL End-exec.

Define the SQL Communication Area In the working-storage section Exec SQL Include SQLCA End-exec.

Using the SQL Communication Area Exec SQL Update Customer set Discount = :NewDisc where ShipCity = :SlcCusCity End-exec. Evaluate True when SQLState = ‘00000’ perform ProcessRow When SQLState = ‘01000’ perform SQLNoRow When SQLState (1:2) = ’01’ perform SQLWarning When Other perform SQLError End-evaluate. Discount is a column in Customer NewDisc is a variable

Select Into Exec SQL Select CustID, Name, ShipCity, Discount into: :CsCustID, :CsName, :CsShipCity, CsDiscount from Customer where CustId = :SlcCustId End-exec. CustID, Name, ShipCity, Discount Are columns in the file CSCustid, CSName CSShipCity, CSDiscount Are variables in the Program : indicates a variable in the program

Insert Into Exec SQL Insert Into Customer ( CustId, Name, ShipCity, Discount ) Values ( :CsCustId, :CsName, :CsShipCity, :CsDiscount) End-exec.

Delete Exec SQL Delete from Customer where CustId = :SlcCustID End-exec.

Program Example