How to auto generate a value for random alphabet, alphanumeric, numeric and timestamp for insert query in katalon - katalon

Hi all currently i am new to katalon and i need help to auto generate a value for random alphabet, alphanumeric, numeric and timestamp for insert query in Katalon script.
currently i am hardcoding with my value below:-
String insertquery = 'INSERT INTO Nb.dbo.DOCUMENT (DOCUMENT,DOCUMENT_TYPE,TIMESTAMP,ID) VALUES ('PP','C231','2022-08-03 22:50:53','22')'
CustomKeywords.'com.database.database.execute'(insertquery).
Hope that there is someone can guide me for auto-generate value when insert query in Katalon.
Thank you and appreciate

Related

ORACLE SQL Replace null values with previous value depending on other fields

From a query I want to replace the null values of the "cod_account" field, the condition to fill this field is that it must take the previous value only if it satisfies that the previous records of other fields (cod_agen, cod_sub, no_prod) are equal.
Currently it is like this:
enter image description here
what is desired is
enter image description here
thanks for your advice. i solve it
use with to separate queries.
select
case when cod_account is null and class ='Primary'
then null
when cod_account is null and class='Secundary'
then (select cod_account from principals P--principals is table create in a "with"
where fa.cod_agen=P.cod_agen
and fa.cod_sub=P.cod_sub
and fa.no_prod=P.no_prod
and p.class='secundary'
)
...
from signs fa

Unable to insert Arabic alphabets in DB

I am trying to run sql file with below insert query, where this query has to insert arabic alphabets
INSERT INTO language
(locale_id, language_id,
VALUE
)
VALUES (4011951073333968003, 9161117031233296391,
'ابةتثجحخدذرزسشصضطظعغفقكلمنهوي'
);
But the result of this query is,
INSERT INTO language
(locale_id, language_id,
VALUE
)
VALUES (4011951073333968003, 9161117031233296391,
'يوهنملكقÙغعظطضصشسزرذدخحجثتبأ'
);
I am facing this issue, even though, I have set charset to UTF-8.
Second problem :
If I try to specify a number following Arabic alphabets, it is misplaced and get inserted before the declaration of Arabic alphabets, like,
INSERT INTO language
(locale_id, language_id,
VALUE, priority
)
VALUES (4011951073333968003, 9161117031233296391,
1,'ابةتثجحخدذرزسشصضطظعغفقكلمنهوي'
);
Here, Corresponding priority value is 1 but I am unable to declare it after Arabic script, every time, it moves at the beginning, if I declare it after the script.
Can anyone suggest me the solution to resolve this problem?

How to create an update query with typeorm and Oracle json column?

I have an Oracle table with a JSON column that I want to update, and I am using TypeORM with javascript. I need to access the JSON column in the where clause, following is the raw sql query and what I am attempting with typeORM:
Query updates the date to current date where the key's (inside the json column) value is 123.
entityManager.query(`UPDATE TABLE_NAME T
SET DATE = CURRENT_DATE
WHERE T.JSON_COLUMN.key = '123'`)
The query with createQueryBuilder:
tableRepository.createQueryBuilder()
.update('TABLE_NAME')
.set({DATE: '2021-07-23 10:07:10'})
.where('JSON_COLUMN.key = :key', {key: '123'})
.execute();
I am not sure how to access the JSON column's key in the where clause. Ideally, I would use the dot operator in SQL to access the JSON columns key value pairs, like so:
JSON_Column_Name.key = value but I cannot find a way to implement it with Oracle.
Any help would be appreciated.

Cannot update a row with a bind variable in UPDATE statement

I am using Oracle SQL Developer 4.0.0.13.
Query :
UPDATE employes
SET emptime = systimestamp
WHERE emp_id = 123
AND emp_device = :abc;
Field Definition : emp_device char(20 byte)
Value is : 99998000000008880999 (This value is present in the table)
When I run the above query in SQL developer it asks me to give the value for the bind variable, which I paste in the text box and it returns 0 rows updated.
But when I remove the bind variable in the update query and specify the actual value, it updates the column value. Below is the query.
Query:
UPDATE employes
SET emptime = systimestamp
WHERE emp_id = 123
AND emp_device = 99998000000008880999 ;
---(works)
Also, when I add some trailing spaces in the bind variable text box and trim the emp_device column, it updates the column. Below is the query.
Query :
UPDATE employes
SET emptime = systimestamp
WHERE emp_id = 123
AND emp_device = trim(:abc);
-- (works --- :abc value is '99998000000008880999 ')
I do not know what is wrong with it. Can someone please take a look and suggest a solution.
You are using CHAR type for your emp_device datatype. Note that CHAR type always blank pads the resulting string out to a fixed width.read this.
You should use VARCHAR2 as datatype if you are expecting a string or just NUMBER as your example consists purely of numeric values.
in dialog box enter your parameter as '99998000000008880999' use apostrophe chars.

Parse a varchar2 Column Value

I want to remove a piece of a string from a particular table's column. The string I wish to remove is the &expires and everything after it but leave everything before the &expires the same. Is there a way to accomplish with the update statement or is a stored procedure needed?
Table column value is:
Starting Value: DAABq3J65GvwBABbWdkFOnpCj2mEA1lMonZBZADcTYJR6QuLPUlfZBtMyoEl4x2JXQ49cOzjZAStQxWNOgrurtnMNIw04bmOcQ4SsrjuPKH4AZBBBAf8ZBjWhs8BM52aC0OpnPGzjm6V2x50qk6wboT&expires=5183999
Desired Ending Value:
DAABq3J65GvwBABbWdkFOnpCj2mEA1lMonZBZADcTYJR6QuLPUlfZBtMyoEl4x2JXQ49cOzjZAStQxWNOgrurtnMNIw04bmOcQ4SsrjuPKH4AZBBBAf8ZBjWhs8BM52aC0OpnPGzjm6V2x50qk6wboT
update table set column = regexp_replace(column, '&'||'expires=.*$')

Resources