sql - Function to create a view not working in postgresql - ERROR: column does not exist -
i trying make function creates simple view stored function.
below query:
create or replace function cc_getbalancesfordate_vw(thedate date) returns void $body$ create view cc_showbalances_vw select * cc_getbalancesfordate(thedate::date); $body$ language sql
if execute above query in pgadmin sql window works. if run query below
select cc_getbalancesfordate_vw('2014-02-15');
to test function getting following error
error: column "thedate" not exist line 5: select * cc_getbalancesfordate_vw(thedate::date);
thedate not column. looking date pass function parameter.
i have tried following:
create or replace function cc_getbalancesfordate_vw(thedate date) returns void $body$ begin create view cc_showbalances_vw select * cc_getbalancesfordate(thedate); end; $body$ language plpgsql volatile
i got same error. have looked on , cant find example this. examples found run static query table. not single example using function parameter.
sorry there mistakes. fact remains same, still not work. need call function make view function. naming irrelevant @ point. wrong in syntax.
any appreciated.
thank you
jason
i have looked on , cant find example this. examples found run static query table. not single example using function parameter.
because view "static query table (or tables)" - , not accept parameters
what attempting, use function create view wrong.
your use of naming conventions odd also. name cc_getbalancesfordate_vw belongs view (_vw)
Comments
Post a Comment