Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Learning PostgreSQL
  • Table Of Contents Toc
Learning PostgreSQL

Learning PostgreSQL

By : Salahaldin Juba, Achim Vannahme, Andrey Volkov
4.3 (6)
close
close
Learning PostgreSQL

Learning PostgreSQL

4.3 (6)
By: Salahaldin Juba, Achim Vannahme, Andrey Volkov

Overview of this book

PostgreSQL is one of the most powerful and easy to use database management systems. It supports the most advanced features included in SQL standards. The book starts with the introduction of relational databases with PostegreSQL. It then moves on to covering data definition language (DDL) with emphasis on PostgreSQL and common DDL commands supported by ANSI SQL. You will then learn the data manipulation language (DML), and advanced topics like locking and multi version concurrency control (MVCC). This will give you a very robust background to tune and troubleshoot your application. The book then covers the implementation of data models in the database such as creating tables, setting up integrity constraints, building indexes, defining views and other schema objects. Next, it will give you an overview about the NoSQL capabilities of PostgreSQL along with Hstore, XML, Json and arrays. Finally by the end of the book, you'll learn to use the JDBC driver and manipulate data objects in the Hibernate framework.
Table of Contents (16 chapters)
close
close
15
Index

Function handling

For calling stored procedures, JDBC provides the CallableStatement interface, which extends PreparedStatement. The API defines two escape syntaxes, which can be used to call a function on the database:

  • {? = call <procedure-name>[(?, ?, …)]}
  • {call <procedure-name>[(?, ?, …)]}

The first form includes a return parameter, while the second one does not. The list of parameters passed to the function can contain both input and output parameters. If a function does not expect any parameters, it can be left out completely.

Examples of function handling are as follows:

  • {? = call random}: A call to a function without parameters
  • {call setval(?, ?)}: A call without a return parameter
  • {? = call substring(?, ?, ?)}: A call with the return parameter and the function parameter list

Calling a stored function

To execute a function from Java code, the first step is to get a CallableStatement from the open connection as follows:

CallableStatement statement =
              ...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Learning PostgreSQL
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon