I have a stored procedure, called SP_CALC_BUCKET, defined. I can call it like so: and this works, and returns the result I expect. However, if I try to call this stored procedure for each row returned from a SELECT statement: I get the following error: Unknown user-defined function SP_CALC_BUCKET Clearly, the Syntax is informing Snowflake that it should look for
Tag: stored-procedures
PSQL stored procedures using arrays as parameter
I’m using PostgreSQL and currently creating a stored procedure to do some calculations. I’ve been searching all morning and reading the documentation, but either the functionality I want isn’t supported or I must’ve overlooked something. Basically, this is what I have: Basically what happens is that I calculate how often I need to make a travel to deliver something, which
Can we use parameters in case statement in snowflake sql stored procedure
I am working on a stored procedure in snowflake using sql language which expects three parameters. I need to execute different sql queries based on the parameter value of the third parameter. For eg, if the 3rd parameter is A, then execute sql_query1. If 3rd parameter is B, then execute sql_query2 and so on. Is there a way to do
What can I use instead of “Set Identity Insert On”?
I have stored procedure in SQL Server. In this procedure, I delete duplicate records and insert one unique records to table. When I insert new unique record I am using below script. Everthing is okey with this script but in the production SET IDENTITY_INSERT command needs to ALTER permission. Giving this permission should be dangerous so I can’t give this
Just out of interest, why cant you include paramters to an SP inside a WITH statement?
I’m working on some VB.NET and need to kick off a SQL SP and if I put the following: Visual Studio will suggest that it can be simplified by using a WITH so it would now look like this: However, any parameters being passed to the SP have to remain outside the {} and it will not allow .Parameters.AddWithValue etc.
Assign group_id to all linked records in many-to-many table
There are 3 tables in my DB; Table 1 has ‘Collateral’, Table 2 has ‘Loans’, Table 3 is a multi-link table between 1 and 2; let’s call it ‘Loan_Collateral_link’. A collateral can belong to 1 or more Loans, and a Loan can have multiple Collaterals. What I want to achieve, is create a separate result set (or table) in which
Create database user using stored procedure MS SQL [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 months ago. Improve this question I have an idea to create database user (account with username and password that can access MS SQL database with
How can I pass a stored procedure parameter into a cursor in snowflake?
I am currently trying to pass a parameter into a stored procedure and use this parameter when creating a cursor unsuccessfully. Here is a simplified snippet of the code I currently have for creating the stored procedure: I then call the stored procedure using: However, when this stored procedure is run, it just runs the string ‘ ||:TABLE2PROFILE|| ‘ without
SQL – Running of SP sums the first row as NULL
I’m trying to develop a SP for Transaction operation , The SP gets as parameters the Username of the player , The Transaction amount, and the Type of the Transaction if it’s Deposit / Draw . My problem is when the first row enters to the table my TotalAmount column in the tables the sums the total amount by Username
Save the output of a procedure in snowflake in a variable
I have following procedure: Now I want to do two things: First I would like to save the output of the procedure in the variable todays_amount So I tried this: But this does not work. And second: Instead of where TARGET_KEY = ’20’ i would like to do where TARGET_KEY = targetkey_variable But this does not work. Answer It appears