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
Tag: stored-procedures
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 VARR…
How to pass table name and column name dynamic in SQL
I was trying to pass table name and column name dynamic, this is as part of SSIS process I am trying this stored procedure below. On executing this, I am NOT getting count as result, instead I am getting execution success. I need to get the count as output. Also my simple direct query is like this Answer I th…
Contents of a folder (retrieved via stored procedure) not loading onto page
I’m running a stored procedure in order to get the contents of a folder and display them on a page. When I run the procedure I can see all of the documents that are in the folder, but on the page …
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.WeeklyAggreg…
PL/SQL change value in 1 row in procedure
i do not know where the bug is. I must write the procedure where the 1 specific row will be chaned. Everytime i lunched it, wrote me: Errors: PROCEDURE RENAME_FLYTICKET Line/Col: 1/65 PLS-00103: …
Find rows containing delimited words within nvarchar parameter
I have a procedure that selects an offset of rows from a table: In addition to @Start and @Length parameters, the procedure also receives @SearchValue NVARCHAR(255) parameter. @SearchValue contains a string of values delimited by a space, for example ‘1 ik mi’ or ‘Li 3’. What I need is…
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&…
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. IR…