Sunday, 23 September 2018

Generating non-repeating random numbers in JS


Generating non-repeating random numbers in JavaScript

I was solving a JavaScript task, and it requested to print a random tip about JavaScript, but I didn't want to print it to repeat the tip as it boring to see the same tip over and over again. So I have built the below code to do it using (math.random), recursive function and foreach loop.

Before you judge I am still in the learning process 😀😀😁, waiting your feedback.


See the Pen Generating non-repeating random numbers in JS by Mohamed El Ghandour (@GunnZ) on CodePen.




Monday, 3 September 2018

Oracle Procedure to commit per DML statement (PL/SQL)

Commit single transaction Procedure


This procedure can be used in APIs or SQL scripts to commit a DML statement, without committing the other transaction the same script.


--This procedure is used to call an specific DML statment
-- and you need to commit the DML statment only

CREATE OR REPLACE PROCEDURE AUTON_DML (p_dmlstat VARCHAR2)
AS
   PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN                                       -- Main transaction suspends here.
   EXECUTE IMMEDIATE p_dmlstat;         -- Autonomous transaction begins here.

   COMMIT;                                -- Autonomous transaction ends here.
END;                                         -- Main transaction resumes here.


--------------------- How to USE -------------------------------------
----------------------------------------------------------------------
---EXECUTE AUTON_DML(q'[UPDATE staging_pm_schedule_table SET NOTE = 'TEST_Variable']');
--OR
---EXECUTE AUTON_DML('UPDATE staging_pm_schedule_table SET NOTE = '''TEST_Variable'''');

--*----------========----------========----------========------------*--
--*--========---- Created by: Mohamed El Ghandour :D ----========----*--
--*----------========----------========----------========------------*--