Skip to content

Tag: stored-procedures

Call stored procedure in Snowflake query

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

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

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

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