I'm unable to create a simple if/else function in ...
# help
n
I'm unable to create a simple if/else function in my database. If I use the example from postgresqltutorial.com it also fails. Any pointers would help..
n
Hello @Nin! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
n
Copy code
if 1+1=2 then
  SELECT 1;
else
  SELECT 0;
END if;
This is the query I'm trying
g
You have to declare the function language to plpgsql and you have to have begin at start and end; at end
n
Aaaaaaaaah. Forgetting the simple stuff again.. Damn.
n
Thread was archived by @Nin. Anyone can send a message to unarchive it.
n
Thanks Gary! You're saving me from lots of frustration.
g
There is something simple about Postgres? 😎
n
It can render a message with less code than JS.
n
Thread was archived by @Nin. Anyone can send a message to unarchive it.