I’m trying to recreate an existing View in Snowflake (originally in SQL Server). I need to get last month’s data which is easy enough, but here’s the scenario: On 3-1-21, it should retrieve 2-1-21 to 3-1-21, but then starting on 3-2-21, it should only show 3-1-21 to-date, as our month end reporting goes out on the 1st of the month,
Tag: function
How to create a SQL function to parse multiple xml formatted strings?
I am trying to parse a price from a price column in SQL. I have already create a function that will parse the price but it only works if “all” price strings are the same on all items. I realize now that I need a more robust function that can parse out multiple price configuration. Here is my simple SQL
Calling Procedure with ‘call’ function from within P/L SQL Script Oracle
I am not able to run this simple if/then statement in oracle database. (i think it is 10.x but not sure, seems to be an issue of my sql skill not db version). Can you help me figure out how to run …
SQL Query to display dates weekly from current date
I have a requirement to display dates every week starting from current date for 48 months. I was wondering if it is possible through SQL or i will have to write a function to achieve it. Below is my …
SQL Server Grouped Number Generation
I need a way in a SQL Server query to generate grouped numbers when the data switches from one specific data value to another. Based on the first two columns below and how they are ordered, how can the query generate the numbers in the third column? When the Type column changes from Prim to anything else, all the records
Postgres Function exists in a particular schema
I have postgres DB which has multiple schemas, is there a way (query) which I can run to figure out if a function exists in a specific schema or in other words print a list of schema names under which a given function exists. Answer You can adapt following query:
NetSuite ODBC Limitations
I’m trying to find out if anyone is aware of any list of the limitations of NetSuite’s ODBC SuiteAnalytics Connect Service being used through OpenQuery? I’ve been running into many problems with some of my more complex queries failing for no apparent reason, and I finally started narrowing it down to some sort of strange limitations that I wasn’t expecting
ORA-06553: PLS-801:Internal Error [55018]
I want to make a function call like SELECT URUN_GETIR(‘test1’) FROM DUAL; but i got ORA-06553: PLS-801: Internal Error [55018]. I tried ORA-06553: PLS-801: internal error [55018] when testing function returning ROWTYPE this like for ex URUN_GETIR(‘test1’).KULUSERNAME but getting same error. It didn’t work for me.Thanks in advance. My db table : My plsql function code : Answer You can
Define a CLOB input parameter for Oracle function (OR Define a function with CLOB input parameter)
I am going to run a code block like below: In which its purpose is to create a function that one of its input argument is CLOB data type. But by executing my code, I get following error: ORA-01704: string literal too long I searched on the internet and also among stackoverflow questions but it didn’t get any consequence. Could
Unable to MAX(COUNT) and have multiple columns
I have 4 tables, EMPLOYEE, DRIVER, TRIP and TRIPLEG EMPLOYEE table has Name which I want to extract and show with MAX count, has E# which is shared with DRIVER DRIVER table has L#(licence number) which is common with TRIP TRIP table has T#(trip number) which is common with TRIPLEG I’m trying to find the max number of tripleg a