Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
63 views

I have a script in postgres to create test data and error Error: relation "schema" does not exist is being thrown. I have verified that the schema and function exists and that I can run the ...
ferd tomale's user avatar
1 vote
2 answers
118 views

How does create or replace function in PostgreSQL 14 behave with respect to transactions? If there are multiple concurrent transactions running at read committed isolation level, and trying to create ...
Aliaksei's user avatar
  • 1,038
2 votes
3 answers
163 views

I have created a recursive SQL Server scalar-valued function that converts XML data to a JSON string. The function works well for most cases, including nested elements and handling of arrays (using a ...
Ragavendra GJ's user avatar
3 votes
2 answers
210 views

I am writing a T-SQL function to convert XML data into a JSON string. My goal is to automatically group repeated child elements with the same tag name into a JSON array, rather than creating separate ...
Ragavendra GJ's user avatar
3 votes
1 answer
185 views

I have changed STABLE to IMMUTABLE and expecting it to work faster, but it works more slower. Did I miss something? IMMUTABLE function: test=> \sf+ rls_guard CREATE OR REPLACE FUNCTION ...
Eugen Konkov's user avatar
  • 26.1k
2 votes
1 answer
79 views

I am sharing some SQL procedures with a webforms application and also a Web API. To do that, in ASP.NET Core Web API, I can use the code shown below. The first part gets the list of records. However, ...
pepr's user avatar
  • 21.1k
2 votes
2 answers
97 views

Source data - table name temp: Source value ID A C123 111 B V123 111 A C456 222 B V456 222 I need to convert the column name source output as a new column header and store the column name value output ...
John Smith's user avatar
0 votes
4 answers
130 views

UPDATE I have tried most of the offered solutions and they work only when I pass a specific 'material_id'. When I run the function on a bigger dataset it runs forever... I work in Azure Synapse on a ...
MariaT's user avatar
  • 147
-2 votes
2 answers
262 views

I am trying to select the maximum ImportDate for each person. For this person "Bob James" he should have the last 2 rows selected with ID 267311 and 267342. I need to see every column in the ...
Austin 's user avatar
1 vote
1 answer
97 views

I have a table as following: create table test ( id varchar(20), text varchar(20) ); insert into test values(1, 'a') insert into test values(2, 'b') insert into test values(3, 'c') To check ...
xi20's user avatar
  • 153
-2 votes
2 answers
81 views

I want to write a PL/SQL function with 4 arguments: SEARCH_STRING, CHECK_STRING, SEARCH_CHAR and CHECK_CHAR where the function will check the SEARCH_STRING against the CHECK_STRING and detect whether ...
Duc Do's user avatar
  • 1
-4 votes
2 answers
122 views

I select data from temporary table: CREATE TEMPORARY TABLE IF NOT EXISTS "tmp" ( "fuel_type" TEXT, "litres" NUMERIC(8,2), "is_rent" BOOLEAN ); ...
Ascerd's user avatar
  • 1
0 votes
1 answer
283 views

I have a function in supabase that updates two tables (Messages and Games), I've now added a third (Users) and for some reason its unable to access it, I've added a debug_logs table to figgure out ...
Ben Klino's user avatar
-4 votes
2 answers
100 views

When I call this function for 700k rows it is very slow. This function calculates the number of holidays between two dates. ALTER FUNCTION [dbo].[HolyCount] ( @StartTime datetime, @...
Adel's user avatar
  • 17
0 votes
1 answer
148 views

What factors led to the introduction of functions alongside stored procedures in SQL, and how do functions specifically enhance the flexibility and efficiency of database operations compared to stored ...
Mridul Thakur's user avatar
0 votes
1 answer
103 views

in the JSON_KEYS function, i dont understand what is return type: https://docs.singlestore.com/cloud/reference/sql-reference/json-functions/json-keys/ according the doc : Return Value: A JSON array ...
Lukas Pistelak's user avatar
0 votes
0 answers
196 views

I am using Django Framework in Python with MySQL Database For adding a table in the database, I create a class in models.py and then run python manage.py makemigrations. This creates the migration ...
Charmi's user avatar
  • 123
-2 votes
2 answers
216 views

I am working with a stored procedure where I am getting a string with different characters I want to get a value at last index [AV] Z_Prem_454-3000_XXXXX_800+ [InstalmentScheme 6] above is the string ...
Pratex's user avatar
  • 127
0 votes
1 answer
131 views

I'm using Postgres for the first time and am confused by an "ambiguous" error regarding my functions. CREATE TABLE "user" ( user_id VARCHAR(40) PRIMARY KEY, email VARCHAR(...
Tristan's user avatar
  • 1,806
0 votes
1 answer
639 views

I am trying to populate some calculated columns after each new row INSERT in PostgreSQL, but I can't get it to work. I have already read these posts (I know these are for SQLite - this question was ...
skeetastax's user avatar
  • 1,816
-2 votes
1 answer
136 views

I'm using MariaDB version 10.3.39. I have create a table named "sys_config" with multiple columns. A column name is "json_system". It's data type is assigned to "longtext"...
Scott Jennings's user avatar
0 votes
0 answers
181 views

To fetch the result, and search functionality, I took the approach of writing SQL Function and use it in the spring boot backend, using native query. To do that I have created a function as shown ...
MightyThor's user avatar
0 votes
1 answer
48 views

I have a table in bigquery with a string field that I need to read, disassemble and generate a new field with several rows receiving the disassembled field The field has values ​​like this: Column A ...
Paulo Medeiros's user avatar
0 votes
1 answer
42 views

I'm getting an error on this Presto SQL code in subscribes and unsubscribes function and variable names: SELECT emailaddress, firstname, lastnamename, role, status, optindate, ...
Pardeep Singh's user avatar
0 votes
1 answer
49 views

I have this table with two autogenerated columns: CREATE TABLE driver_orders ( id SERIAL PRIMARY KEY, car_id INTEGER NOT NULL, location_from GEOGRAPHY -- generated GENERATED ...
ABDULLOKH MUKHAMMADJONOV's user avatar
0 votes
2 answers
107 views

I created a function that returns all values that meet the condition specified and tried specifying int[] as the result type of the function. create or replace function mults_of_3_5(id int) returns ...
Devansh Gupta's user avatar
0 votes
2 answers
39 views

I need a solution for string from column values like 'abc xyz-1234' to 'xyz, abc'. What will be the Oracle SQL query for above solution. SELECT SUBSTR (COLUMN_NAME, INSTR (' ', ...
Amol Salunke's user avatar
0 votes
0 answers
49 views

I'd like to create function using pgplsql which takes table name and column name and returns this column as result. The main problem which I faced is dynamic type of this columns (might be int/float/...
Philipp's user avatar
  • 29
1 vote
1 answer
376 views

Need to Generate Tag Number While Inserting Data using JSON in SQl Server Stored Procedure. I have 2 Tables Table1: Category (lastusedIndex null in initial stage) Id categoryname assetPrefix ...
Relax's user avatar
  • 327
0 votes
2 answers
67 views

There are multiple historical rows present for a customer in customer table and a id has been assigned which might have changed overtime Name ID Date Abhishek 1 23-08-2023 Abhishek 1 03-08-2023 ...
smriti mishra's user avatar
1 vote
1 answer
281 views

I'm trying to use the LAG function in SQL to attempt this but I'm unsure if I am using this incorrectly or not. What I am trying to do is where you see a NULL under the LOCAL_ID column, fill that NULL ...
Sunny0101's user avatar
  • 576
1 vote
2 answers
472 views

I want to write a function like this: CREATE OR ALTER FUNCTION TestFunction() RETURNS TABLE AS RETURN WITH NumberList AS ( SELECT 1 AS Number UNION ALL SELECT Number + 1 FROM ...
Daniel Jonsson's user avatar
0 votes
2 answers
436 views

I have a dataframe like below and need to find the least value except zeros and add it in a new column as 'Least'. Column1 Column2 Column3 100.0 120.0 150.0 200.0 0.0 0.0 0.0 20.0 100.0 I tried with ...
RMK's user avatar
  • 41
0 votes
0 answers
77 views

I need to do a function in an older version of informix that I need to validate a mail: so I need a function that check the email pattern [a-zA-z0-9]@[a-zA-Z0-9].[a-zA-Z0-9] Also in the last one that ...
Martí Castell's user avatar
1 vote
1 answer
1k views

I have a pyspark dataframe with below data [ My code: W = Window.partitionBy("A").orderBy(col("C")) main_df = main_df.withColumn("cnt", F.count("B").over(W)) ...
Passive_coder's user avatar
0 votes
1 answer
102 views

I want to create a function in SQL that takes in a field name and field type and returns a boolean value. Based on the result, I will decide whether or not to update the field type. Here is the code ...
Zheng Li's user avatar
3 votes
2 answers
70 views

My first post in Stackoverflow. I am trying to learn Postgresql (12) "on the job" and seem to be stuck on a rather simple issue. I have a simple database with 12 rows. In one column (int) ...
James's user avatar
  • 43
-1 votes
1 answer
68 views

I have a table called Projects where I need to set a certain column value after an update is executed and the record matches certain conditions. The function triggers correctly and there are no errors ...
Samuel Alito's user avatar
1 vote
1 answer
102 views

I am trying to write a postgres function that takes an array of arrays (e.g. [[65.8434183140001,38.905535066],[65.8433595220001,38.905479615],[65.843286031,38.9054103],[65.843108611,38.9055251450001],[...
ABDULLOKH MUKHAMMADJONOV's user avatar
-3 votes
1 answer
118 views

I was trying to write a function: If a row exists it returns the row with a flag 'Exists'; otherwise it inserts a row and returns it with a flag 'New'. But I am facing a syntax error: ERROR: syntax ...
Prajwal Abraham's user avatar
0 votes
3 answers
391 views

I have data like this: String 1: 'Random Text 3 Random 568 Text 5.5 Test Random Text 345' String 2: 'Random Text 3 Test Text Random' String 3: 'Random Text 777 Random Text' The output I expect is: ...
Lloyd Thomas's user avatar
1 vote
1 answer
83 views

I work on SQL Server 2012 I face error and I don't know how to solve error Msg 8120, Level 16, State 1, Line 43 Column '#servers.ServerId' is invalid in the select list because it is not contained in ...
ahmed abdelaziz's user avatar
-1 votes
1 answer
184 views

I have a function that in theory will give the country name as output when the input is the city name: CREATE OR REPLACE FUNCTION public.country_by_city(city varchar, OUT Country varchar) RETURNS ...
lowercase male's user avatar
0 votes
1 answer
50 views

I want to find the nearest coordinates to validate the place name as the format type is FLOAT, then I cannot use LIKE function as it is only applicable for STRING format. situation example; my ...
Syarqawi Ruslan's user avatar
0 votes
0 answers
182 views

How does the STBuffer function measure distances around a polygon? I am looking at the expression: select SP_GEOMETRY.STBuffer(100) and wondering how the 100-meter buffer is calculated around the ...
Hayley's user avatar
  • 1
2 votes
1 answer
152 views

How to generate a sequence of SQUARE numbers till 10 in MYSQL? (1^2,2^2, etc) I was only able to generate a numerical sequence from 1 to 10. WITH RECURSIVE cte (n) AS ( SELECT 1 UNION ALL SELECT ...
Mouse12328's user avatar
0 votes
1 answer
122 views

I am trying to make a trigger and function that inserts into the table purchases the values which have been inserted into the table customers. Columns of table customers 1-customer_id serial PK ...
user avatar
0 votes
2 answers
300 views

I have a query that selects the rows from joined table as an array using ARRAY_AGG() function. select entity_number, ARRAY_AGG('{"property_id":"'||property_id||'","...
ABDULLOKH MUKHAMMADJONOV's user avatar
0 votes
1 answer
237 views

I'm new to databases and SQL and i've been messing around with functions on POSTGRESQL and I made a simple function to select all names from a table. But the function, when called, returns just a ...
user avatar
0 votes
1 answer
669 views

I am trying to make a table called Citizens in postgresql using PGadmin and inside this table there is a column called ageand I want this age to be calculated and put inside this column when I insert ...
user avatar

1
2 3 4 5
19