Reputation: 3512
I have SQL function, it is not written by me.
I am having hard time understanding, what does following condition mean?
specifically :key
and ||cLF||'
.
WHERE ' WHERE 1=1 '
||cLF||' AND f.key = :key '
||cLF||' AND i.flag = 0'
||cLF||' AND r.flag = 0'
Upvotes: 3
Views: 7922
Reputation: 153
The query you have pasted is a part of a dynamically constructed SQL statement. Semicolon here points to a bind-place holder, meaning that the actual value for ":key" is passed through an argument and not hard coded.
Read examples on EXECUTE IMMEDIATE.
Upvotes: 1
Reputation: 91618
First, the ||
operator is a string concatenation operator. So it looks like the code is building a WHERE
clause using conditions specified by cLF
. Though I'm not entirely sure why they're tacking on cLF
three times there.
The :key
syntax refers to a parameter in a parameterized query. Its value will be passed in when the SQL statement you're building is actually run.
Upvotes: 3