Error in running Procedure for LOAD_DATA

Hi,

I am new to memSQL and trying to create a procedure which will load the data in a table from the file.
I am facing error as shown below while trying to run the procedure. The procedure is compiled but execution is showing issues.
Can you please suggest where I am going wrong.

  1. Procedure definition

DELIMITER //
CREATE PROCEDURE SP_LOAD_TEST_TABLE_PROC1(v_file_path VARCHAR(100)) AS

BEGIN
LOAD DATA INFILE ‘’‘v_file_path’’’ INTO TABLE frm_crisp.TEST_TABLE_PROC1
FIELDS TERMINATED BY ‘,’
LINES TERMINATED BY ‘\n’ ;

END //
DELIMITER ;

  1. Proc execution
    call SP_LOAD_TEST_TABLE_PROC1(’/ms/user/r/ramanman/CRISP/CRISP_FMS_AGGREGATE_Copy.csv’);

  2. I am getting below error
    memsql> call SP_LOAD_TEST_TABLE_PROC1(’/ms/user/r/ramanman/CRISP/CRISP_FMS_AGGREGATE_Copy.csv’);
    ERROR 1017 (HY000): Unhandled exception
    Type: ER_FILE_NOT_FOUND
    Message: Can’t find file: ‘‘v_file_path’’ (errno: 2)
    Callstack:
    #0 Line 4 in frm_crisp.SP_LOAD_TEST_TABLE_PROC1

  3. I tried changing the LOAD DATA part in the proc with the below, but this is also showing same issue

LOAD DATA INFILE ‘’’||v_file_path||’’’ INTO TABLE frm_crisp.TEST_TABLE_PROC1

LOAD DATA INFILE CONCAT(’,v_file_path,’) INTO TABLE frm_crisp.TEST_TABLE_PROC1

Thanks in advance

You can’t substitute a variable or parameter like you are trying to do in the LOAD DATA statement in your SP. Try dynamic SQL (EXECUTE IMMEDIATE) instead.