Skip to content

Tag: dynamic-sql

How to rotate a two-column table?

This might be a novice question – I’m still learning. I’m on PostgreSQL 9.6 with the following query: My query returns the following dynamic rows: locales count en 10 fr 7 de 3 n additional locales (~300)… n-count I’m trying to rotate it so that locale values end up as columns with a s…

Like in dynamic function

The code below works well. I however have issues trying to turn it into a like statement that I need some assistance with So far, I have tried the code below but with not much success I have also tried; Answer If your stored procedure parameter is @deliverer and your dynamic SQL parameter is @pt, I believe yo…

ora-00900 invalid sql statement execute immediate

I am trying to solve a task with a dynamic SQL, but facing an issue ora-00900 invalid sql statement. However, it works in the anonymous block treating the statement to be executed as a string. So where is the issue in the first case? It looks like with escape quotes, but can’t catch this. Answer As the error …

Dynamic SQL stored procedure and datetime

I have a simple query that I want to convert to dynamic SQL. I have 2 input parameters: a table and a datetime. And the output is the rowcount for the table and this specific datetime. I tried different solutions. I tried the query with execute sp_executesql, I tied to add the the ”’ before and af…