Answers for "sql output"

SQL
3

sql insert inserted id

-- Never use @@identity or scope_identity()
-- they can not always be relied upon

DECLARE @Ids_tbl TABLE ([id] INT); -- Requires table. use variable for scope
INSERT INTO [sometable] ([ColA],[ColB])
OUTPUT INSERTED.ID INTO @Ids_tbl(id)
VALUES ('valA','valB');

SELECT [id] FROM @Ids_tbl; -- <-- Id(s) in here
Posted by: Guest on May-15-2020
0

sql output select

DECLARE
BEGIN
FOR result IN (
    SELECT sysdate AS TODAY, sysdate+1 AS TOMORROW FROM DUAL
    )
    LOOP
        dbms_output.put_line(result.TODAY|| ' ' || result.TOMORROW);
    END LOOP;
END;
Posted by: Guest on April-06-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language