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

            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?
            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);
            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;
            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.