| От | Wiebe Cazemier |
|---|---|
| Тема | unique names in variables and columns in plsql functions |
| Дата | |
| Msg-id | 4427F7D3.3000103@gmail.com обсуждение исходный текст |
| Ответы |
Re: unique names in variables and columns in plsql functions
Re: unique names in variables and columns in plsql functions |
| Список | pgsql-sql |
Hi, In a plpgsl function, consider the following excerpt: DECLARE provider_id INTEGER; BEGIN provider_id := (SELECT provider_id FROM investment_products WHERE id = my_new.investment_product_id); END; After a lot of trouble, I found out this line doesn't work correctly with the variable name as it is. It doesn't give an error or anything, it just retrieves some wrong value (probably NULL). When I change the variable name to anything other than "provider_id", it works OK. I was somewhat surprised to discover this. Can't Postgres determine that the provider_id in the SELECT statement is not the same one as the variable?
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера