[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-04 (世界標準時間)。"],[[["\u003cp\u003eBigQuery system procedures are similar to user-created stored procedures and offer built-in functionality.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBQ.ABORT_SESSION\u003c/code\u003e terminates the current session or a specified session by ID.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBQ.JOBS.CANCEL\u003c/code\u003e cancels a running job, requiring the job ID and project ID if executed from a different project.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBQ.REFRESH_EXTERNAL_METADATA_CACHE\u003c/code\u003e refreshes the metadata cache of a BigLake or object table, with an option to specify subdirectories for partial refreshes, but cannot be used with automatic caching mode.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBQ.REFRESH_MATERIALIZED_VIEW\u003c/code\u003e refreshes a materialized view, and requires the view name, including the project ID if it's in a different project.\u003c/p\u003e\n"]]],[],null,["# System procedures reference\n===========================\n\nBigQuery supports the following system procedures, which can be\nused similarly to user-created [stored procedures](/bigquery/docs/procedures).\n\nBQ.ABORT_SESSION\n----------------\n\n**Syntax** \n\n```sql\nCALL BQ.ABORT_SESSION([session_id]);\n```\n\n**Description**\n\nTerminates your current session.\n\nYou can optionally specify the [session ID](/bigquery/docs/sessions#get-id),\nwhich lets you terminate a session if the system procedure isn't called from\nthat session.\n\nFor more information, see\n[Terminating sessions](/bigquery/docs/sessions#terminate-session).\n\nBQ.JOBS.CANCEL\n--------------\n\n**Syntax** \n\n```sql\nCALL BQ.JOBS.CANCEL(job);\n```\n\n**Description**\n\nCancels a running job.\n\nSpecify the job as a string with the format `'[project_id.]job_id'`. If you run\nthis system procedure from a different project than the job, then you must\ninclude the project ID. You must run the procedure in the same location as the\njob.\n\nFor more information, see\n[Canceling a job](/bigquery/docs/managing-jobs#cancel_jobs).\n\nBQ.REFRESH_EXTERNAL_METADATA_CACHE\n----------------------------------\n\n**Syntax** \n\n```sql\nCALL BQ.REFRESH_EXTERNAL_METADATA_CACHE(table_name [, [subdirectory_uri, ...]]);\n```\n\n**Description**\n\nRefreshes the metadata cache of a BigLake table or an object table.\nThis procedure fails if you run it against a table that has the metadata\ncaching mode set to `AUTOMATIC`.\n\nTo run this system procedure, you need the `bigquery.tables.update` and\n`bigquery.tables.updateData` permissions.\n\nSpecify the name of the table as a string with the format\n`'[project_id.]dataset.table'`. If you run this system procedure from a\ndifferent project than the table, then you must include the project ID.\n\nFor BigLake tables, you can optionally specify one or more\nsubdirectories of the table data directory in\nCloud Storage in the format `'gs://table_data_directory/subdirectory/.../'`.\nThis lets you refresh only the table metadata from those subdirectories and\nthereby avoid unnecessary metadata processing.\n\n**Examples**\n\nTo refresh all of the metadata for a table: \n\n```sql\nCALL BQ.REFRESH_EXTERNAL_METADATA_CACHE('myproject.test_db.test_table')\n```\n\nTo selectively refresh the metadata for a BigLake table: \n\n```sql\nCALL BQ.REFRESH_EXTERNAL_METADATA_CACHE('myproject.test_db.test_table', ['gs://source/uri/sub/path/d1/*', 'gs://source/uri/sub/path/d2/*'])\n```\n\n**Limitation**\n\n- Metadata cache refresh is not supported for tables referenced by linked datasets over external datasets.\n- Metadata cache refresh shouldn't be used in a [Multi-statement transaction](/bigquery/docs/transactions).\n\nBQ.REFRESH_MATERIALIZED_VIEW\n----------------------------\n\n**Syntax** \n\n```sql\nCALL BQ.REFRESH_MATERIALIZED_VIEW(view_name);\n```\n\n**Description**\n\nRefreshes a materialized view.\n\nSpecify the name of the materialized view as a string with the format\n`'[project_id.]dataset.table'`. If you run this system procedure from a\ndifferent project than the materialized view, then you must include the project\nID.\n\nFor more information, see\n[Manual refresh](/bigquery/docs/materialized-views#manual_refresh)."]]