1. The following Code creates a top100cur () function, which returns an anonymous cursor.
-- Drop function top100cur (); Create Function top100cur () returns refcursor as $ declare ABC refcursor; beginopen ABC for select * From person limit 100;
Don't say it, first on the code.Pg:--Establishment of T1 tableCREATE TABLE Public. T1 (F1INTEGER not NULL, F2VARCHAR( -), F3VARCHAR( -)[][] [], CONSTRAINTT1_pkeyPRIMARY KEY(F1)) with(OIDs=false);--Create an array of T1 table behavior elements to
MySQL stored procedures can easily return multiple result sets at a time, but POSTGRESQL currently does not provide such a function.
A literal translation method is to use a cursor, but you can also put the result set in an array or a large
-- Drop function top100cur (refcursor); Create Function top100cur (refcursor) returns refcursor as $ beginopen $1 for select * From person limit 100; return $1; end $ language plpgsql; ---------- test cursor ----------- select top100cur ('abc'); --
Recently because the work needs to write a login check function, words not much to say, paste code, because it is just a simple introduction to use, so the core judgment I have all removed.The first requirement is to return only one user ID, so a
Stored ProceduresImplementation function: For salary scale under 30 years of age, salary increase 10% 30 to 40 increase 20% 40 + 30% + bonus (admission) return average compensation
To create a table:
DROP TABLEEmps;CREATE TABLEEmps
JAVA advanced programming: Java calls the stored procedure-general Linux technology-Linux programming and kernel information. For details, see the following. This article describes how to use DBMS stored procedures. I have explained the basic and
This article describes how to use DBMS stored procedures. I have explained the basic and advanced features of using stored procedures, such as returning resultset. This article assumes that you are familiar with DBMS and JDBC, and that you can read
program | stored Procedure | design | data | Database This article explains how to use DBMS stored procedures. Describes the basic and advanced features of using stored procedures, such as returning resultset. This article assumes that you are
A stored procedure is a program that is saved in a database and executed on the database side. You can use special syntax to invoke stored procedures in a Java class. At invocation time, the name of the stored procedure and the specified parameters
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.