16
Views
3
Comments
Solved
How to generate some amount of data in Aurora for PostgreSQL table, in ODC platform ?
Application Type
Reactive

Hello,

I was trying to build an example of application in ODC that have a Timer to fill the table with random data, like mentioned below:

But, when trying to test this SQL, some errors appear:

Apparently, the SQL Insert command is correct.

Is there any way to check were is the problem ?

Thanks, in advance.

2019-01-07 16-04-16
Siya
 
MVP
Solution

Syntax for  insert statement  is incorrect.  It should be 

INSERT INTO {MinhaTabela} (Codigo, DataRegistro) and not INSERT INTO {MinhaTabela}.[Codigo], {MinhaTabela}.[DataRegistro]

A query worked for me is 

INSERT INTO {MinhaTabela} (Codigo, DataRegistro)SELECTSUBSTRING(MD5(random()::text), 1, 10),TO_DATE('2020-01-01', 'YYYY-MM-DD')+ (random() * (CURRENT_DATE - TO_DATE('2020-01-01', 'YYYY-MM-DD'))::INT)::INTFROM generate_series(1, 1000);

with MinhaTabela ( Id (Auto), Codigo (Text : 50), DataRegistro(Date)


2022-12-22 10-00-39
Beatriz Sabino
Solution

Hi Sven,

Like Siya mentioned your SQL syntax is wrong.

I just want to add that you can find the differences in SQL queries compared to OutSystems 11 here

2019-01-07 16-04-16
Siya
 
MVP
Solution

Syntax for  insert statement  is incorrect.  It should be 

INSERT INTO {MinhaTabela} (Codigo, DataRegistro) and not INSERT INTO {MinhaTabela}.[Codigo], {MinhaTabela}.[DataRegistro]

A query worked for me is 

INSERT INTO {MinhaTabela} (Codigo, DataRegistro)SELECTSUBSTRING(MD5(random()::text), 1, 10),TO_DATE('2020-01-01', 'YYYY-MM-DD')+ (random() * (CURRENT_DATE - TO_DATE('2020-01-01', 'YYYY-MM-DD'))::INT)::INTFROM generate_series(1, 1000);

with MinhaTabela ( Id (Auto), Codigo (Text : 50), DataRegistro(Date)


2022-12-22 10-00-39
Beatriz Sabino
Solution

Hi Sven,

Like Siya mentioned your SQL syntax is wrong.

I just want to add that you can find the differences in SQL queries compared to OutSystems 11 here

2024-03-21 14-36-50
Sven Bleckwedel

Hello, Syia and Beatriz,

Thanks for your comments and corrections.

Now it´s working as expected:

Tks in adv.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.