Posts by Oberdan • 47 points
9 posts
-
0
votes1
answer63
viewsA: How to return a data even if the table has no data
You can write a Function for this: CREATE OR REPLACE FUNCTION esta_vazia() RETURNS text language plpgsql as $_$ DECLARE registros record; BEGIN SELECT * INTO registros FROM table1; IF (registros…
-
0
votes3
answers10991
viewsA: How to escape quotes in Postgresql?
The $ delimiter can be used to separate expressions. Example: DO $_$ BEGIN RETURN QUERY EXECUTE $$ || SELECT * FROM alunos || $$; END; $_$ Note that the use of the $ can be named: $x$ or $test$. Do…
-
0
votes1
answer144
viewsA: Consume REST API from a PL (Postgresql 11)
A solution based on Postgrest. This tool acts by providing the API, has HTTP support and meets this type of request. One important detail: Replies to requests are returned in JSON
-
0
votes3
answers74
viewsA: SQL Query autodelete
You can use the RETURNING command DELETE FROM usuarios WHERE nome = lucas RETURNING *; You can also use the name of the fields. Example: DELETE FROM usuarios WHERE nome = lucas RETURNING id;…
-
0
votes1
answer804
viewsA: Receive data from Alpha via serial in C#
In your Arduino code, modify the Serial.write command to Serial.Println. The latter sends the data output to the connected application. Note: Serial.read receives in bytes. void setup() {…
-
-2
votes2
answers671
viewsA: Faster delete + Insert or select + update
This is a very common procedure used by charging offices, for transmitting large customer lists. We call this "Charge". Every day two different systems can talk to each other sending and receiving…
-
1
votes2
answers129
viewsA: Return - Method called in Form1, and Return in form2
If this is what I’m thinking it’s simple. Look at this example: static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void…
-
3
votes2
answers40109
viewsA: Get values from one table that are not contained in another
Another way to get this information is through LEFT JOIN or RIGHT JOIN Observe: Table A contains the fields a,b,c Table B contains the fields a,b,c,d,e,f SELECT A.a, A.b, A.c, B.d, B.e, B.f FROM A…
-
1
votes1
answer92
viewsA: Postgressql - Stored Procedure
You should call your function with all the information you request as parameters. In the case of Smt parameter use simple quotes since its function is requesting a varchar. SELECT * FROM…