Skip to content
Advertisement

Tag: stored-procedures

tweaking stored proc

I have a stored proc that gets called with a parameter. I would like to check what the PARAM @Value is, and depending on the value, I want to add a part of a WHERE clause if it equals to a certain value. Let’s say the proc looks like this: This is a much simpliefied code, my WHERE clause for

Fetch multiple rows with PL/SQL procedure

Procedure: This procedure works for me. I am executing the procedure with below code: Execution: I have to call the procedure in java with JDBC. So how can I call the procedure in java by above execution code? Answer Use a collection (which you can create using CREATE TYPE … AS TABLE OF …) or VARRAY (like the built-in VARRAYs

How do I add 1 to a column value on an insert into statement in a stored procedure?

I have a table that is updated every hour (RPT.SummaryAggregates). I need to create a stored procedure that fills a table (RPT.WeeklyAggregates) with a snapshot of the total records in (RPT.SummaryAggregates) once a week (this SP will be setup with a SQL Agent Job). I need the Week column of (RPT.WeeklyAggregates) to automatically increase by 1 incrementally every time the

Input parameters in procedure

Tell me how to solve such a case: There is a predicate in the stored procedure that searches for input_param by the input parameter: When calling this procedure, I need to pass two or much parameters: It naturally doesn’t work Are there any solutions? Answer Would this help? Sample data: Procedure:

Stored Procedure error – incorrect syntax near else

I’m working on my first stored procedure, and it’s showing an error at the else (where I have a comment at the else below). If anyone knows how I can fix the error, I’d appreciate it. I’ve tried looking online, and I think it may have to do with my begin/end and if/else positioning. I’m having trouble finding a similar

SQL: Update a table column with data in column retrieved from a view in same procedure

I’m trying to do a select and update within the same local procedure. The idea is to retrieve the number of ordered products from a specific order in the view (Produktantal) and then updating the stock numbers (antal) from the table “produktlager” with the data retrieved from the view. I’m receiving the follow error message Error: ER_BAD_FIELD_ERROR: Unknown column ‘Produktantal’

Advertisement