Re: SQL SERVER migration to PostgreSql

From: SERHAD ERDEM <serhade(at)hotmail(dot)com>
To: İlyas Derse <ilyasderse(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL SERVER migration to PostgreSql
Date: 2019-11-08 14:31:26
Message-ID: VI1PR0601MB2304AFD4DA55F118F5381496A37B0@VI1PR0601MB2304.eurprd06.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

CREATE OR REPLACE FUNCTION get_film (p_pattern VARCHAR)

RETURNS TABLE (

film_title VARCHAR,

film_release_year INT

)

AS $$

BEGIN

RETURN QUERY SELECT

title,

cast( release_year as integer)

FROM

film

WHERE

title ILIKE p_pattern ;

END; $$

LANGUAGE 'plpgsql';

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

CREATE OR REPLACE FUNCTION get_film (p_pattern VARCHAR,p_year INT)

RETURNS TABLE (

film_title VARCHAR,

film_release_year INT

) AS $$

DECLARE

var_r record;

BEGIN

FOR var_r IN(SELECT

title,

release_year

FROM film

WHERE title ILIKE p_pattern AND

release_year = p_year)

LOOP

film_title := upper(var_r.title) ;

film_release_year := var_r.release_year;

RETURN NEXT;

END LOOP;

END; $$

LANGUAGE 'plpgsql';

________________________________
From: İlyas Derse <ilyasderse(at)gmail(dot)com>
Sent: Thursday, November 7, 2019 1:28 PM
To: pgsql-general(at)lists(dot)postgresql(dot)org <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: SQL SERVER migration to PostgreSql

I'm trying to migration to PostgreSql from SQL Server. I have Stored Procedures what have output parameters and returning tables.But you know what, we can not returning tables in stored procedures in PostgreSql and we can not use output parameters in functions in PostgreSql.

So i did not find to solves this problem. Anybody have an idea ?

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Brad Nicholson 2019-11-08 14:57:43 Re: AW: AW: AW: AW: broken backup trail in case of quickly patroni switchback and forth
Previous Message Zwettler Markus (OIZ) 2019-11-08 12:51:33 AW: AW: AW: AW: broken backup trail in case of quickly patroni switchback and forth