# TOAD throws warning, code executes in SQL PLUS

**URL:** <https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364>\
**Category:** Toad for Oracle & DevOps Toolkit\
**Created:** [January 21, 2015, 4:20am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364 "2015-01-21T04:20:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anjali\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Anjali\_Sharma](https://forums.toadworld.com/u/Anjali_Sharma)\
**Post date:** [January 21, 2015, 4:20am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/1 "2015-01-21T04:20:33Z")

</div>

Hi,

I have a strange situation. I am running below mentioned code from 2 TOAD versions:

SELECT LEAD (dummy IGNORE NULLS)OVER(ORDER BY dummy DESC) from dual where dummy = :var;

a. Toad for Oracle 12.6.0.53

b. Toad for Oracle Xpert Trial 11.0.0.116

In version a I get warning and when i try to run code it does not show bind variable in pop up. I have attached screenshot for same.

In version b, it shows warning but shows bind variable in pop up and runs fine.

Why am I getting this warning even if code is working fine from SQL plus?

Thanks,

Anjali

Anjali.

 ![0458.Screenshot.png](https://global.discourse-cdn.com/quest/original/2X/a/aea81184668d837098844cb214eec4580b8a0822.png)

---

<div class="post-metadata">

**Author:** ![Dennis\_Paulus](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/dennis_paulus/32/138_2.png) [@Dennis\_Paulus](https://forums.toadworld.com/u/Dennis_Paulus)\
**Post date:** [January 21, 2015, 5:19am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/2 "2015-01-21T05:19:29Z")

</div>

I tried 11.0 and I see that the variable is prompted for (as you mentioned), however, I get an error when actually trying to run it - same for in SQL Plus.  
The problem is the ‘IGNORE’ - it’s expecting an offset there. I’m not sure how this worked in SQL Plus for you when you ran it - at least, I wasn’t able to replicate it.

The only way I could make it work was to remove the IGNORE and replace it with the offset, which is the what the LEAD function expects. When you do this  
in Toad, then the bind variable shows up correctly, because it’s valid syntax.

# SELECT LEAD (dummy,1)OVER(ORDER BY dummy DESC) from dual where dummy

:var;

[http://docs.oracle.com/cd/B19306\_01/server.102/b14200/functions074.htm](http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions074.htm)

**From:** Anjali\_Sharma [[mailto:bounce-Anjali\_Sharma@toadworld.com](mailto:bounce-Anjali_Sharma@toadworld.com)]

**Sent:** Wednesday, January 21, 2015 7:21 AM

**To:** [toadoracle@toadworld.com](mailto:toadoracle@toadworld.com)

**Subject:** [Toad for Oracle - Discussion Forum] TOAD throws warning, code executes in SQL PLUS

**[TOAD throws warning, code executes in SQL PLUS](http://www.toadworld.com/products/toad-for-oracle/f/10/t/23603.aspx)**

Thread created by Anjali\_Sharma

Hi,

I have a strange situation. I am running below mentioned code from 2 TOAD versions:

SELECT LEAD (dummy IGNORE NULLS)OVER(ORDER BY dummy DESC) from dual where dummy = :var;

a. Toad for Oracle 12.6.0.53

b. Toad for Oracle Xpert Trial 11.0.0.116

In version a I get warning and when i try to run code it does not show bind variable in pop up. I have attached screenshot for same.

In version b, it shows warning but shows bind variable in pop up and runs fine.

Why am I getting this warning even if code is working fine from SQL plus?

Thanks,

Anjali

Anjali.[![](http://www.toadworld.com/resized-image.ashx/ __size/550x0/__ key/communityserver-discussions-components-files/10/0458.Screenshot.png)](http://www.toadworld.com/cfs-file.ashx/__key/communityserver-discussions-components-files/10/0458.Screenshot.png)

To reply, please reply-all to this email.

[Stop receiving emails](http://www.toadworld.com/products/toad-for-oracle/f/10/t/23603.aspx?subscribe=false) on this subject.

Or [  
Unsubscribe from Toad for Oracle - General](http://www.toadworld.com/products/toad-for-oracle/f/10.aspx?subscribe=false) notifications altogether.

Toad for Oracle - Discussion Forum

[Flag](http://www.toadworld.com/products/toad-for-oracle/f/10/t/23603.aspx?AbuseContentId=f0740e3b-31ce-4f8c-a2c9-1bbbab290fa8&AbuseContentTypeId=46448885-d0e6-4133-bbfb-f0cd7b0fd6f7&AbuseFlag=true)  
this post as spam/abuse.

![](http://04j0.mjt.lu/o/04j0/d22e446f/gz7lo97e.gif)

---

<div class="post-metadata">

**Author:** ![Anjali\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Anjali\_Sharma](https://forums.toadworld.com/u/Anjali_Sharma)\
**Post date:** [January 21, 2015, 5:56am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/3 "2015-01-21T05:56:50Z")

</div>

Hey Dennis,

The offset doesn’t give me the desired result. I ran this from SQL plus and works fine for me

SELECT LEAD (dummy,1)OVER(ORDER BY dummy DESC) from dual where dummy = ‘X’;

---

<div class="post-metadata">

**Author:** ![Anjali\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Anjali\_Sharma](https://forums.toadworld.com/u/Anjali_Sharma)\
**Post date:** [January 22, 2015, 3:15am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/4 "2015-01-22T03:15:27Z")

</div>

Hey,

Any suggestions anyone.

---

<div class="post-metadata">

**Author:** ![Dennis\_Paulus](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/dennis_paulus/32/138_2.png) [@Dennis\_Paulus](https://forums.toadworld.com/u/Dennis_Paulus)\
**Post date:** [January 22, 2015, 4:19am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/5 "2015-01-22T04:19:01Z")

</div>

Anjali - as mentioned before, the syntax you’re using is incorrect. You mentioned that using the offset doesn’t give you the desired result, but from the  
example you provided, it’s impossible to know what the desired result is.

Create a simple example using the SCOTT schema like on the Oracle page I sent you and we can try to help you further, however, this wouldn’t be a Toad question  
as much as it is a SQL or SQL\*Plus question. My suggestion would be to post this to an Oracle forum, however, we can try to help you as much as we can.

SELECT last\_name, hire\_date,

LEAD(hire\_date, 1) OVER (ORDER BY hire\_date) AS “NextHired”

FROM employees WHERE department\_id = 30;

or

select  
ename, hiredate,

lead(hiredate,1)OVER(order  
by hiredate)  
as  
“nexthired”

from  
scott.emp

# where deptno

30;

**From:** Anjali\_Sharma [[mailto:bounce-Anjali\_Sharma@toadworld.com](mailto:bounce-Anjali_Sharma@toadworld.com)]

**Sent:** Thursday, January 22, 2015 6:16 AM

**To:** [toadoracle@toadworld.com](mailto:toadoracle@toadworld.com)

**Subject:** RE: [Toad for Oracle - Discussion Forum] TOAD throws warning, code executes in SQL PLUS

**[RE: TOAD throws warning, code executes in SQL PLUS](http://www.toadworld.com/products/toad-for-oracle/f/10/p/23603/51382.aspx#51382)**

Reply by Anjali\_Sharma

Hey,

Any suggestions anyone.

To reply, please reply-all to this email.

[Stop receiving emails](http://www.toadworld.com/products/toad-for-oracle/f/10/t/23603.aspx?subscribe=false) on this subject.

Or [  
Unsubscribe from Toad for Oracle - General](http://www.toadworld.com/products/toad-for-oracle/f/10.aspx?subscribe=false) notifications altogether.

Toad for Oracle - Discussion Forum

[Flag](http://www.toadworld.com/products/toad-for-oracle/f/10/p/23603/51382.aspx?AbuseContentId=6e426a0e-ccb1-4d08-884c-5af1de78eba7&AbuseContentTypeId=f586769b-0822-468a-b7f3-a94d480ed9b0&AbuseFlag=true)  
this post as spam/abuse.

![](http://04j0.mjt.lu/o/04j0/b2cce0c7/gtnknzze.gif)

---

<div class="post-metadata">

**Author:** ![Anjali\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Anjali\_Sharma](https://forums.toadworld.com/u/Anjali_Sharma)\
**Post date:** [January 22, 2015, 5:54am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/6 "2015-01-22T05:54:42Z")

</div>

Hi Dennis,

My data is something like this:

Dummy

* * *

NULL

XXX

NULL

NULL

YYY

NULL

NULL

NULL

ZZZ

NULL

AAA

I want output as:

Dummy

* * *

XXX

YYY

ZZZ

AAA

Now I can’t fix the offset for LEAD functions as 1 or 2 or any other number as I can’t determine where next NOT NULL value is available. That’s the reason I used IGNORE NULLS in LEAD.

Also, it’s not a query error I am concerned with. My only issue is that since query is working fine and returning me data in way I want, then why is it showing warning in TOAD?

Thanks,

Anjali

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [January 22, 2015, 7:23am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/7 "2015-01-22T07:23:03Z")

</div>

This looks like a parser bug. If you replace the bind variable with a value it works.

On 01/22/2015 08:55 AM, Anjali\_Sharma wrote:

> **[RE: TOAD throws warning, code executes in SQL PLUS](http://www.toadworld.com/products/toad-for-oracle/f/10/p/23603/51386.aspx#51386)**

> Reply by Anjali\_Sharma  
> Hi Dennis,

> My data is something like this:

> Dummy

> * * *

> NULL

> XXX

> NULL

> NULL

> YYY

> NULL

> NULL

> NULL

> ZZZ

> NULL

> AAA

> I want output as:

> Dummy

---

<div class="post-metadata">

**Author:** ![Anjali\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Anjali\_Sharma](https://forums.toadworld.com/u/Anjali_Sharma)\
**Post date:** [January 22, 2015, 7:29am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/8 "2015-01-22T07:29:22Z")

</div>

It seems to be TOAD issue. It works fine with sqldeveloper.

---

<div class="post-metadata">

**Author:** ![mstaszew](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/mstaszew/32/23_2.png) [@mstaszew](https://forums.toadworld.com/u/mstaszew)\
**Post date:** [January 22, 2015, 7:31am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/9 "2015-01-22T07:31:35Z")

</div>

It is and has been reported to the developer.

---

<div class="post-metadata">

**Author:** ![Anjali\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/aca169/32.png) [@Anjali\_Sharma](https://forums.toadworld.com/u/Anjali_Sharma)\
**Post date:** [January 22, 2015, 7:40am UTC](https://forums.toadworld.com/t/toad-throws-warning-code-executes-in-sql-plus/32364/10 "2015-01-22T07:40:34Z")

</div>

Ok great. Please do let me know once we get resolution for it.
