Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-36336

Is there a way to get current procedure name inside the Stored Procedure

Details

    Description

      In my stored procedure, we have a requirement to store the current procedure name in my table dynamically without hardcoding or passing as parameter to the procedure. How can i do this ?

      Attachments

        Issue Links

          Activity

            jaswanth Jaswanth created issue -
            danblack Daniel Black made changes -
            Field Original Value New Value
            Issue Type Task [ 3 ] New Feature [ 2 ]
            danblack Daniel Black made changes -
            Priority Blocker [ 1 ] Major [ 3 ]
            danblack Daniel Black added a comment -

            I don't believe so. It would be a system variable if so. Is there another SQL implementation doing a similar feature or a SQL standard for this?

            danblack Daniel Black added a comment - I don't believe so. It would be a system variable if so. Is there another SQL implementation doing a similar feature or a SQL standard for this?
            danblack Daniel Black made changes -
            Component/s Data Definition - Procedure [ 10119 ]
            Component/s Storage Engine - InnoDB [ 10129 ]
            danblack Daniel Black made changes -
            Labels innodb stored_procedures stored_procedures
            danblack Daniel Black made changes -
            Summary Is there a way to get current procedure name inside the Stored Procedure Innodb. Is there a way to get current procedure name inside the Stored Procedure
            jaswanth Jaswanth added a comment -

            In SQLServer/MSSQL, it has a way to get the procedure name using the following command
            SELECT OBJECT_NAME(@@PROCID);

            jaswanth Jaswanth added a comment - In SQLServer/MSSQL, it has a way to get the procedure name using the following command SELECT OBJECT_NAME(@@PROCID);
            danblack Daniel Black made changes -
            serg Sergei Golubchik added a comment -

            You can do it like

            select object_name
            from performance_schema.threads left join performance_schema.events_statements_current using (thread_id)
            where processlist_id=connection_id() and sql_text=processlist_info;
            

            serg Sergei Golubchik added a comment - You can do it like select object_name from performance_schema.threads left join performance_schema.events_statements_current using (thread_id) where processlist_id=connection_id() and sql_text=processlist_info;
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] Needs Feedback [ 10501 ]
            jaswanth Jaswanth added a comment -

            We didn't enable performance_schema in our prod environment. Is there any other way without using performance_schema ?

            jaswanth Jaswanth added a comment - We didn't enable performance_schema in our prod environment. Is there any other way without using performance_schema ?

            People

              Unassigned Unassigned
              jaswanth Jaswanth
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.