Create trigger that Find, Parse and Insert to another table After inserting on tablePrevent record from being...

Where is the fallacy here?

Why do phishing e-mails use faked e-mail addresses instead of the real one?

Don't know what I’m looking for regarding removable HDDs?

Is there a math equivalent to the conditional ternary operator?

How can atoms be electrically neutral when there is a difference in the positions of the charges?

Toast materialize

Why can't we make a perpetual motion machine by using a magnet to pull up a piece of metal, then letting it fall back down?

The need of reserving one's ability in job interviews

Sometimes a banana is just a banana

Graphing random points on the XY-plane

How to mitigate "bandwagon attacking" from players?

What could trigger powerful quakes on icy world?

How can I create a Table like this in Latex?

Reason why dimensional travelling would be restricted

Can a space-faring robot still function over a billion years?

Citing contemporaneous (interlaced?) preprints

Is the withholding of funding notice allowed?

What is this waxed root vegetable?

A right or the right?

What should the omniscient narrator call a character?

Real life puzzle: Unknown alphabet or shorthand

How to evaluate the limit where something is raised to a power of x?

Can throughput exceed the bandwidth of a network

Inverse of the covariance matrix of a multivariate normal distribution



Create trigger that Find, Parse and Insert to another table After inserting on table


Prevent record from being inserted in the table in After TriggerHow to commit transaction on an after update event trigger?How to get currently inserted rows and sum them within Mysql trigger before insertCreating SQL Server triggers to copy a record from one table and populate anothertrigger to delete records with same value from another table after inserting record in another tableDoes after insert trigger cause delay?MySQL trigger before insert replace the data with relational tableTwo Interconnected MySql Trigger on two different TablesProblems with insert trigger and primary keyMysql trigger to update if date match and insert if no match all BEFORE INSERT













0















I want to create a trigger that will insert to another table after inserting on my table.



Scenario:
I will insert on my inbox table.
Then, on my inbox table there is a field named Msg.
Next, I want to parse the Msg before inserting it.
The data is: su:11:2016-07-18:2:125~1, 124~100



    CREATE TRIGGER account_insert AFTER INSERT ON inbox FOR EACH ROW
BEGIN
SELECT
SPLIT_STR(Msg, ':', '1') AS u,
SPLIT_STR(Msg, ':', '2') AS o,
SPLIT_STR(Msg, ':', '3') AS dt,
SPLIT_STR(Msg, ':', '4') AS t
FROM inbox ORDER BY Datestamp DESC

INSERT ON account (trx_id, user_id, outlet_id, date_captured) VALUES(t, u, o, dt)

END;


So the output must be like this:



trx_id = 2
user_id = su
outlet_id =11
date_captured = 2016-07-18


I cannot run this on MySQL.










share|improve this question
















bumped to the homepage by Community 4 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    I want to create a trigger that will insert to another table after inserting on my table.



    Scenario:
    I will insert on my inbox table.
    Then, on my inbox table there is a field named Msg.
    Next, I want to parse the Msg before inserting it.
    The data is: su:11:2016-07-18:2:125~1, 124~100



        CREATE TRIGGER account_insert AFTER INSERT ON inbox FOR EACH ROW
    BEGIN
    SELECT
    SPLIT_STR(Msg, ':', '1') AS u,
    SPLIT_STR(Msg, ':', '2') AS o,
    SPLIT_STR(Msg, ':', '3') AS dt,
    SPLIT_STR(Msg, ':', '4') AS t
    FROM inbox ORDER BY Datestamp DESC

    INSERT ON account (trx_id, user_id, outlet_id, date_captured) VALUES(t, u, o, dt)

    END;


    So the output must be like this:



    trx_id = 2
    user_id = su
    outlet_id =11
    date_captured = 2016-07-18


    I cannot run this on MySQL.










    share|improve this question
















    bumped to the homepage by Community 4 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0








      I want to create a trigger that will insert to another table after inserting on my table.



      Scenario:
      I will insert on my inbox table.
      Then, on my inbox table there is a field named Msg.
      Next, I want to parse the Msg before inserting it.
      The data is: su:11:2016-07-18:2:125~1, 124~100



          CREATE TRIGGER account_insert AFTER INSERT ON inbox FOR EACH ROW
      BEGIN
      SELECT
      SPLIT_STR(Msg, ':', '1') AS u,
      SPLIT_STR(Msg, ':', '2') AS o,
      SPLIT_STR(Msg, ':', '3') AS dt,
      SPLIT_STR(Msg, ':', '4') AS t
      FROM inbox ORDER BY Datestamp DESC

      INSERT ON account (trx_id, user_id, outlet_id, date_captured) VALUES(t, u, o, dt)

      END;


      So the output must be like this:



      trx_id = 2
      user_id = su
      outlet_id =11
      date_captured = 2016-07-18


      I cannot run this on MySQL.










      share|improve this question
















      I want to create a trigger that will insert to another table after inserting on my table.



      Scenario:
      I will insert on my inbox table.
      Then, on my inbox table there is a field named Msg.
      Next, I want to parse the Msg before inserting it.
      The data is: su:11:2016-07-18:2:125~1, 124~100



          CREATE TRIGGER account_insert AFTER INSERT ON inbox FOR EACH ROW
      BEGIN
      SELECT
      SPLIT_STR(Msg, ':', '1') AS u,
      SPLIT_STR(Msg, ':', '2') AS o,
      SPLIT_STR(Msg, ':', '3') AS dt,
      SPLIT_STR(Msg, ':', '4') AS t
      FROM inbox ORDER BY Datestamp DESC

      INSERT ON account (trx_id, user_id, outlet_id, date_captured) VALUES(t, u, o, dt)

      END;


      So the output must be like this:



      trx_id = 2
      user_id = su
      outlet_id =11
      date_captured = 2016-07-18


      I cannot run this on MySQL.







      mysql trigger






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 20 '16 at 8:31









      Philᵀᴹ

      25.5k65591




      25.5k65591










      asked Jul 20 '16 at 8:12









      John MichaelJohn Michael

      1




      1





      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 4 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          There is no SPLIT_STR(). But a couple uses of SUBSTRING_INDEX() will do the trick.






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "182"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f144407%2fcreate-trigger-that-find-parse-and-insert-to-another-table-after-inserting-on-t%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            There is no SPLIT_STR(). But a couple uses of SUBSTRING_INDEX() will do the trick.






            share|improve this answer




























              0














              There is no SPLIT_STR(). But a couple uses of SUBSTRING_INDEX() will do the trick.






              share|improve this answer


























                0












                0








                0







                There is no SPLIT_STR(). But a couple uses of SUBSTRING_INDEX() will do the trick.






                share|improve this answer













                There is no SPLIT_STR(). But a couple uses of SUBSTRING_INDEX() will do the trick.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 20 '16 at 21:40









                Rick JamesRick James

                43.1k22259




                43.1k22259






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Database Administrators Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f144407%2fcreate-trigger-that-find-parse-and-insert-to-another-table-after-inserting-on-t%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    ORA-01691 (unable to extend lob segment) even though my tablespace has AUTOEXTEND onORA-01692: unable to...

                    Always On Availability groups resolving state after failover - Remote harden of transaction...

                    Circunscripción electoral de Guipúzcoa Referencias Menú de navegaciónLas claves del sistema electoral en...