# Is there anyway to use retract in Swish?

**URL:** <https://swi-prolog.discourse.group/t/is-there-anyway-to-use-retract-in-swish/3652>\
**Category:** Help!\
**Created:** [February 27, 2021, 11:22am UTC](https://swi-prolog.discourse.group/t/is-there-anyway-to-use-retract-in-swish/3652 "2021-02-27T11:22:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![joeblog](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/joeblog/32/122_2.png) [@joeblog](https://swi-prolog.discourse.group/u/joeblog)\
**Post date:** [February 27, 2021, 11:22am UTC](https://swi-prolog.discourse.group/t/is-there-anyway-to-use-retract-in-swish/3652/1 "2021-02-27T11:22:54Z")

</div>

If hit the snag of _No permission to call sandboxed `retract(\_1684)’_ when trying to translate an SQL delete example in my [Swish database tutorial](https://swish.swi-prolog.org/p/sql2prolog.swinb).

Is there some magic incantation to allow facts to be removed from the database in Swish?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 27, 2021, 11:52am UTC](https://swi-prolog.discourse.group/t/is-there-anyway-to-use-retract-in-swish/3652/2 "2021-02-27T11:52:45Z")

</div>

retract/1 works fine, but the argument needs to be a sufficiently instantiated term. If not, it can be a module qualified term and retract things outside the sandbox. So you get something like

```prolog
forall(member(p(X), Terms), retract(p(X))).

```

---

<div class="post-metadata">

**Author:** ![joeblog](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/joeblog/32/122_2.png) [@joeblog](https://swi-prolog.discourse.group/u/joeblog)\
**Post date:** [February 27, 2021, 12:02pm UTC](https://swi-prolog.discourse.group/t/is-there-anyway-to-use-retract-in-swish/3652/3 "2021-02-27T12:02:07Z")

</div>

Many thanks for the prompt response as always @jan

For those who need a fuller explanation, this works:

```prolog
forall(member(student(SID, SName, GPA, SizeHS), Students), 
           retract(student(SID, SName, GPA, SizeHS))).

```

I originally wrote `forall(member(Student, Students), retract(Student)).` which caused the error.
