Skip to Content
0
Apr 01, 2020 at 04:46 PM

How insert record into the table with GENERATED BY DEFAULT from a select sentence

72 Views

I have created a table with GENERATED BY DEFAULT AS IDENTITY and my request is insert all the records of the sentence select.

The SAP HANA XSa indicates the following message:

Cloud not create the data base object

This is my code:

My table

namespace Proyecto_1.Modulo_1.CDS;

context Paises {

/*@@layout{"layoutInfo":{"x":-297,"y":-92.5}}*/

entity Tabla_Enty_1 {

key ID_PAIS : Integer

GENERATED BY DEFAULT AS IDENTITY;

PAIS : String(15);

};

};

My Stored procedure:

PROCEDURE "Proyecto_1.Modulo_1.CDS::MainRun2"( )

LANGUAGE SQLSCRIPT

SQL SECURITY INVOKER

--DEFAULT SCHEMA <default_schema_name>

READS SQL DATA AS

BEGIN

-- Cargo la tabla de Paises

INSERT INTO "Proyecto_1.Modulo_1.CDS::Paises.Tabla_Enty_1" ("PAIS")

SELECT DISTINCT(PAIS)

FROM "Proyecto_1.Modulo_1.Tablas::proveedores"

ORDER BY PAIS;

END;