Writing to two tables from a CSV file
Posted by:
Toan Trac
Date: February 21, 2025 02:28PM
Hi,
I found the code that is able to write the data but want to able to do import of more than one record from a csv file. Can someone help me get started.
Below is the current code that I found.
Thanks ahead, TT
-- Generate salt, set @dis to 0 to activate account
SET @salt = UNHEX(SHA2(UUID(), 256));
SET @dis = '1';
-- Create base entity entry for user
INSERT INTO guacamole_entity (name, type)
VALUES ('user1', 'USER');
-- Create user and hash password with salt
INSERT INTO guacamole_user (
entity_id,
password_salt,
password_hash,
password_date,
disabled
)
SELECT
entity_id,
@salt,
UNHEX(SHA2(CONCAT('user1', HEX(@salt)), 256)),
CURRENT_TIMESTAMP,
@dis
FROM guacamole_entity
WHERE
name = 'user1'
AND type = 'USER';
Subject
Written By
Posted
Writing to two tables from a CSV file
February 21, 2025 02:28PM
Sorry, only registered users may post in this forum.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.