SQL Code: DELETE using instance variable | Community
Skip to main content
February 6, 2023
Solved

SQL Code: DELETE using instance variable

  • February 6, 2023
  • 1 reply
  • 1063 views

I want to delete from a schema abcMySchema. 

In this schema I am storing the Label of the workflow: MyWorkflow.

I have added a SQL Code Action: DELETE FROM abcMySchema WHERE sWorkflowName = <%= instance.label %>;

 

I am getting the following errors:

PGS-22000 PostgreSQL error: ERROR: column "myworkflow" does not exist...

WDB-200001 SQL statement 'DELETE FROM abcMySchema WHERE sWorkflowName = MyWorkflow' could not be executed.

 

I can hardcode the value WHERE sWorkflowName = 'MyWorkflow' and the query runs and deletes the associated records.

 

How do you use the dropdown instance > label in a query?

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Amine_Abedour

Hello @tjforce24 ,

 

Try this : 

DELETE FROM abcMySchema WHERE sWorkflowName = '<%= instance.label %>';

 

Br,

Amine

1 reply

Amine_Abedour
Community Advisor
Amine_AbedourCommunity AdvisorAccepted solution
Community Advisor
February 7, 2023

Hello @tjforce24 ,

 

Try this : 

DELETE FROM abcMySchema WHERE sWorkflowName = '<%= instance.label %>';

 

Br,

Amine

Amine ABEDOUR
tjforce24Author
February 7, 2023

I thought I tried this since it is a string and was getting errors.  This worked for me.  Thanks.