Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

array json para função crp_format(uf,cod) no SQL #2

Open
ppKrauss opened this issue Sep 12, 2016 · 0 comments
Open

array json para função crp_format(uf,cod) no SQL #2

ppKrauss opened this issue Sep 12, 2016 · 0 comments

Comments

@ppKrauss
Copy link
Owner

script src/rgxGen.php precisaria gerar algo para suprir a definição da função SQL... algo como:

function crp_format(char(2),int) ....
SELECT  $1::text || to_char($2, j->>uf)
FROM (
select '{"AC":"fm00-000","AL":"fm000-000","AM":"fm000-000","AP":"fm00-000","BA":"fm0000-000",
"CE":"fm0000-000","DF":"fm0000-000","ES":"fm000-000","GO":"fm0000-000","MA":"fm000-000",
"MG":"fm0000-000","MS":"fm000-000","MT":"fm000-000","PA":"fm0000-000","PB":"fm000-000",
"PE":"fm0000-000","PI":"fm000-000","PR":"fm0000-000","RJ":"fm0000-000","RN":"fm000-000",
"RO":"fm000-000","RR":"fm00-000","RS":"fm0000-000","SC":"fm0000-000","SE":"fm000-000",
"SP":"fm0000-000","TO":"fm000-000","ZM":"fm0000-000"}'::JSONb as j, 
upper($1::text) as uf
) t;
ppKrauss added a commit that referenced this issue Sep 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant