I would like to execute a SELECT statement in a stored procedure, but before executing, I have to know if it will have rows. If not, I have to jump to a specified Label, and set an output. My current method works just fine, but I will need more of these in several procedures, and I was wondering if I
Tag: stored-procedures
How to queue up calls to stored procedures in Oracle?
I have a stored procedure in oracle (which schedules a one-time job to run another procedure, if this is relevant). The job calls another stored procedure which runs for a few minutes, and performs inserts updates and deletes and also uses loops. Now while the long procedure is running, if there is another call for it to run, is it
Stored procedure with string as parameters not working -SQL
In my database ‘Student_name’ is set as varchar. And the stored procedure is: ALTER PROCEDURE [dbo].[SP_STUDENT] @STUDENT_NAME NVARCHAR(MAX), AS DECLARE @columns NVARCHAR(MAX) = ”,…
Get distinct column values to an array
Using below query I get the column values to an array. Now I want to get distinct column values from it. marks_details The @columns should be [1,2,3] Answer
Passing date to Stored Procedure in Oracle SQL error : ORA-01858
I know this question has been answered previously, and I have tried out the solution given in them without success. I have a stored procedure as below(I have removed non-essential parts) : CREATE OR …
Trying to update where clause to only apply to a certain value
I have a stored procedure in my database. It is a dynamic piece of code and runs for multiple different parameters. Let’s say I have a parameter called @Param that gets passed: 17 (this parameter will be different for different processes). In my query I am attempting to use this parameter to update the WHERE clause like this: Does code
How do I get rid of this SQL error from the end of my query when inserting within a procedure?
Not sure if this is even possible but im getting a weird error at the end of my query. Any idea why? Here is the code: CREATE OR REPLACE PROCEDURE NewUser (g_name VARCHAR, f_name VARCHAR, u_password …
select limit in sql
I wrote this query but gives me an error at line 15 (limit clause). we have 3 tables, state, email, and receiver. CREATE PROCEDURE `inbox`(IN `page_size` INT,IN `page_number` INT) BEGIN set @curr …
Update records in SQL by looking up in different table
I am copying data from few tables in SQL server A to B. I have a set of staging tables in B and need to update some of those staging tables based on updated values in final target table in B. Example: Server B: StagingTable1: StagingTable2: After Copying StagingTable1 to TargetTable1 (ID’s get auto polulated and I get new ID’s,
Unable to MAX(COUNT) and have multiple columns
I have 4 tables, EMPLOYEE, DRIVER, TRIP and TRIPLEG EMPLOYEE table has Name which I want to extract and show with MAX count, has E# which is shared with DRIVER DRIVER table has L#(licence number) which is common with TRIP TRIP table has T#(trip number) which is common with TRIPLEG I’m trying to find the max number of tripleg a