How to create PGAdmin III functions and use

In this post, I am going to share  How to create PGAdmin III functions and use. Most of time we have long queries for fetching the records from the database , we generally use for making the queries shorter and less load on the server.

Moreover, when we have to reuse the same SQL queries in more than one SQL queries or functions.

Look into the below steps for more clarification:

  1. Right click on the functions option under the DataBaseName -> schemas -> Public -> Functions and click on New Function as shown on the below snapshot:
  2. After that a new window will open asking for new function name under properties, SQL query language under Definition and SQL query under code button as shown on the below snapshots:

 

Steps for using functions with in a SQL query:

  1. After successfully creating the function Open the SQL editor and writing the function name with parameters and running as shown on the below snapshot:
  2. Here we have call the form2_productcountbyproduct(product.product_id) function with product.product_id – parameter as form2_productcount.
Facebooktwittergoogle_plusredditpinterestlinkedinmail
1 Star2 Stars3 Stars4 Stars5 Stars (12 votes, average: 5.00 out of 5)
Loading...

Leave a Reply

Your email address will not be published. Required fields are marked *