Context I want to use the HANA HIERARCHY_TEMPORAL function to work on a SAP KNVH hierarchy with time intervals ; When simply used in a SELECT query, this works fine ; When otherwise using the very same query but assigning it to a table variable, the result is inconsistent. My problem This anonymous block work…
Tag: function
Trim Intermediate spaces in a string in Postgres
In the result, want only intermediate spaces to be removed. Need to print only first part before hypen (-) along with Percentages. Can you please help. Input String: AMAZON – 25%; SAP – XXXXX – 45%; MICROSOFT – XXX&YYY – 30% Query: Answer regexp_split_to_table can be used to …
Revisting ORA-06576: not a valid function or procedure name for simple function call via various database tools
Revisting ORA-06576: not a valid function or procedure name for simple function call via dbeaver database-tool I have seen many posts, but they don’t cover the situation I am experiencing. I am trying to do a simple function call to Oracle SQL via dbeaver: According to the right-click call function obta…
How to pass an array of JSON (or JSON array) to pg function to be INSERTed into a Table?
Function to insert rows of json array into a table: Call this function: or this form: or this form: Always received: Answer A JSON array (json) is different from a Postgres array of JSON values (json[]). vs: The first is an array nested inside a single JSON value, the second is an array of JSON values. Postgr…
Create a function that accepts a string and returns multiple rows
I’m being required to create a function that transforms a single column’s value based on the user’s input. I need some help on the syntax for doing so. Here is the query I’m currently performing to get the rows: some pseudocode on what I’m trying to do: I’ve been trying to …
Problem with PostgreSQL function parameter of type “name”
I’m writing some PostgreSQL functions to compile a list of search terms for records in a table called name. Since the search terms come from multiple columns on the name table and from multiple columns on other tables, a simple generated column isn’t sufficient. Here’s a simplified version o…
Problem in a function that extracts and saves fields from a database table to another
If in the combo_Nations combobox I select a specific Country (the country name is extracted from the “All_Nations” table in the “Nations_name” column), I would like to get the corresponding ID_Nations of the respective selected country (ID_Nations is found in the same table “All_…
query has no destination for result data, select functions names from schema
I am trying to turn select into function, but keep getting error: “query has no destination for result data”. Select returns 5 columns so I am trying to return table with 5 columns. I can not figure out what I am missing, please help! Answer As the error message suggests, you have to tell the func…
Postgres stored procedure(function) confusion
I’m pretty new to Postgres and SQL as a whole and could use a bit of help with a function here. I have this table: What i need is for a function to take as input plate, start date and end date and throw an error if the table contains any row with the same plate where the rental period
Call tabled function with parameters in sql
I’m a newbie in SQL and with programming languages in general. I’m trying to make a tabled function in SQL (SQL Server): and then I have to call it in another sql page. I’ve tried to use this syntax: If I run my SELECT I don’t have any result, because my parameters are not initialized.…