postgresql - oracle evalname function equivalent in postgres -


oracle supports dynamic xmlelement name evalname function. there similar feature in postgres xmlelement name dynamically instead of using constant?

example in oracle:

select xmlelement(evalname(ename),empno) emp; 

this statement result in list of enames separate xml elements.

<smith>7369</smith> <allen>7499</allen> <ward>7521</ward> 

not sure if postgres has similar.

thanks.

i able workaround construct xml dynamic element names in postgres using execute format. posting in case if had same issue.

execute format('select xmlelement(name %i, $1)', emp_name) using empno emp;  <smith>7369</smith> <allen>7499</allen> 

same worked xmlforest , having xmlattributes inside xmlelement.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -