# Error - gather\_table\_stats

**URL:** <https://forums.toadworld.com/t/error-gather-table-stats/54271>\
**Category:** Toad for Oracle - Beta\
**Created:** [December 14, 2021, 4:41pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271 "2021-12-14T16:41:35Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![espotnitz](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@espotnitz](https://forums.toadworld.com/u/espotnitz)\
**Post date:** [December 14, 2021, 4:41pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/1 "2021-12-14T16:41:35Z")

</div>

I get an error about regular expressions when I try to run stats (see below and attached). When I run the same statement in sqlplus the statement runs successfully. Is there a workaround?

EXEC dbms\_stats.gather\_table\_stats('&&1','&&2',estimate\_percent =\> dbms\_stats.AUTO\_SAMPLE\_SIZE, degree =\> DBMS\_STATS.AUTO\_DEGREE, no\_invalidate =\> true, cascade =\> true, method\_opt =\> 'FOR ALL INDEXED COLUMNS',granularity =\> 'ALL');

 ![2021-12-14 09_37_48-Greenshot](https://global.discourse-cdn.com/quest/original/2X/0/0466d30f5aa3f72ff531ca2012bbf51542f765bc.png)

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [December 14, 2021, 4:58pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/2 "2021-12-14T16:58:48Z")

</div>

I don't get any error on this one. What values did you put into those variables?

Maybe Toad has some saved value for them that is causing problems. What if you change the variable names to something you haven't used before?

---

<div class="post-metadata">

**Author:** ![espotnitz](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@espotnitz](https://forums.toadworld.com/u/espotnitz)\
**Post date:** [December 14, 2021, 5:00pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/3 "2021-12-14T17:00:56Z")

</div>

I used espotnitz for username and fact\_product for the table name. Give me a minute to try changing the variable names.

---

<div class="post-metadata">

**Author:** ![espotnitz](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@espotnitz](https://forums.toadworld.com/u/espotnitz)\
**Post date:** [December 14, 2021, 5:04pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/4 "2021-12-14T17:04:54Z")

</div>

After changing the variable names I get the same error. I will play around and see if I can get this to work.

---

<div class="post-metadata">

**Author:** ![espotnitz](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@espotnitz](https://forums.toadworld.com/u/espotnitz)\
**Post date:** [December 15, 2021, 1:29pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/5 "2021-12-15T13:29:51Z")

</div>

Hi. I played around and tried different things. The only time the error occurs is when I use "Toad Script Runner". When I run from the Toad editor I do not get an error.

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [December 17, 2021, 2:45pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/6 "2021-12-17T14:45:26Z")

</div>

I can reproduce that. TSR still works for other SQL. The problem seems to be more about substitution variables than anything else. I don't think it supports prompting for them like Toad does. I'm logging it so it doesn't get forgotten.

---

<div class="post-metadata">

**Author:** ![espotnitz](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@espotnitz](https://forums.toadworld.com/u/espotnitz)\
**Post date:** [December 17, 2021, 2:56pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/7 "2021-12-17T14:56:47Z")

</div>

Thanks for the update

---

<div class="post-metadata">

**Author:** ![espotnitz](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@espotnitz](https://forums.toadworld.com/u/espotnitz)\
**Post date:** [January 6, 2022, 1:23pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/8 "2022-01-06T13:23:02Z")

</div>

FYI. I tried running this same statement using Toad Runner in Toad version 15.0.97.1178 and I get prompted for the variables and the statement runs successfully. I thought this worked before.

---

<div class="post-metadata">

**Author:** ![JohnDorlon](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/johndorlon/32/9997_2.png) [@JohnDorlon](https://forums.toadworld.com/u/JohnDorlon)\
**Post date:** [January 6, 2022, 1:29pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/9 "2022-01-06T13:29:38Z")

</div>

Yes. It was broken when I added support in Toad to change the Substitution character. It will be fixed next beta.

---

<div class="post-metadata">

**Author:** ![espotnitz](https://avatars.discourse-cdn.com/v4/letter/e/8edcca/32.png) [@espotnitz](https://forums.toadworld.com/u/espotnitz)\
**Post date:** [January 6, 2022, 1:49pm UTC](https://forums.toadworld.com/t/error-gather-table-stats/54271/10 "2022-01-06T13:49:37Z")

</div>

Looking forward to the next beta. Thank you
