Skip to main content

Questions tagged [sql-procedure]

Filter by
Sorted by
Tagged with
0 votes
0 answers
71 views

create procedure function as alternative to DB timeout

So I am fairly new to sql and there is a particular query I make where the DB always timeout. I tried everything, including restarting the server. There is this table where it listed all the events ...
orrie881's user avatar
0 votes
1 answer
1k views

How to write SQL Stored Procedure to ouput a fixed Length/width File

I am using SQL server 2017, I want to write SQL stored procedure to generate a fixed length/width file without using SSIS or wizard TABLE: EmpID EmployeeName Department Birthdate Hiredate 001 John ...
Y.agr's user avatar
  • 13
1 vote
1 answer
1k views

How to return values from psql to bash with custom session settings

I need to set the datestyle to "dd/mm/yyyy" before calling a procedure and getting it's return value back to bash. I tried the following: read return <<< $(psql \ -...
Majd's user avatar
  • 111
-2 votes
1 answer
1k views

How to auto run oracle stored procedure [duplicate]

Is there any possibility to auto run procedure after a specific time/date? For example I want to auto run this stored procedure after 2 days: CREATE OR REPLACE PROCEDURE deleteresetlinks AS BEGIN ...
user230's user avatar
1 vote
2 answers
92 views

Inject aggregation function inside a procedure

Is it possible to inject the name of a function (AVG, MAX...) as a procedure parameter? CREATE PROCEDURE test(func TEXT) LANGUAGE PLPGSQL AS $$ BEGIN DROP TABLE IF EXISTS foo; CREATE TEMPORARY TABLE ...
jorgeb's user avatar
  • 25
1 vote
1 answer
1k views

MYSQL Stored procedure to fetch entire row from a table

I am a beginner to SQL and currently practicing the concept of the stored procedure. I have a table Fetch_Marks that contains 20 records with Student_No and Marks as columns. Now I would like to ...
Novice Developer's user avatar
-2 votes
1 answer
1k views

MySQL trigger calling stored procedure always get null value for out parameter of stored procedure [closed]

My stored procedure OUT parameter, always return a null value. Here is sample Table, Trigger and Procedure code. Table: test Columns: id - Int status - enum(‘pass’, ‘fail’) status - enum(‘pass’, ‘...
Krunal's user avatar
  • 101
0 votes
1 answer
53 views

How to issue a DML with WHERE clause comparing a value which is trigger generated in table?

Suppose I have a table with CREATE, CREATE TABLE TEST ( year int, month int, date int, hr int, min int, sec int, timestamp timestamp, value double ); CREATE ...
Vineet Menon's user avatar
-2 votes
1 answer
35 views

Procedure to change a person's designation [closed]

People are occasionally moved between different departments. I want to create a procedure that accepts a name (name of person) and a department(department that person is assigned to) and changes the ...
Redsam121's user avatar
0 votes
1 answer
32 views

Pull multiple fields from table B where a specific value from Table A is not in Table B

SQL Newbie here. I have a question about pulling multiple fields from a database when one value is not in another table. I have two tables: "Contact" table - contains all of our contact information ...
Christopher Taylor ENG's user avatar
7 votes
1 answer
34k views

How to use variables in procedure (not function)? [closed]

As I understand, in Postgres, procedures are for manipulating data and functions are for reading data. I would like to: declare a variable select a value into a variable insert the variable into ...
Alexander Kleinhans's user avatar
3 votes
1 answer
20k views

"column ... does not exist" error when calling an SQL procedure (new in PostgreSQL 11)

Using PostgreSQL 11 Beta 2, a very simple trading_holiday table is created in the config schema: DROP TABLE IF EXISTS config.trading_holiday; CREATE TABLE config.trading_holiday ( id smallint ...
Michael Goldshteyn's user avatar