Problem with WHERE CLAUSE

Reply
Contributor BSL
Contributor
Posts: 25

Problem with WHERE CLAUSE

Dear Experts,

I am stuck in a problem with a WHERE CLAUSE while testing the first part of the query which is available in attached file i.e. "Complete Code" and that first par is available in "Code". I Checked step by step each part of the query which is available is "Code" and did not find any error but still getting error for WHERE clause. If I remove the WHERE clause, the code available in "Code" file, Its runs with no error.

  So Can anybody help me to resolve the error.

Files                 Details

Code-               1st part of the main code

Complete Code- Complete code for proc step

Log-                  Log for 1st part of the main code

I also attached an sql query with the result that got from query in additional files i.e. SQL Code fr validation.txt and Result.txt

Attachment
Attachment
Attachment
Attachment
Attachment
Super User
Super User
Posts: 7,988

Re: Problem with WHERE CLAUSE

Best to identify the issue.  From a quick look at code.txt you have an additional and statement not finished:

where Iddepotcode = "B000" and

group by...

Contributor BSL
Contributor
Posts: 25

Re: Problem with WHERE CLAUSE

Hi RW9,

I have update the Code file with complete where conditions.

-anand

Super User
Super User
Posts: 7,988

Re: Problem with WHERE CLAUSE

Hi,

Sorry, I am not going to read through all that code.  I will suggest however that you break your code down.  For instance, copy the first section out into a separate proc sql block.  (i.e. select up to union).  Does that part work, if so do the next part.  Do this for every block in the program.   Once you have identified which block is giving the problem, then look at the input dataset to that part, does it have the variables, what does the log say, is there a typo.  I would also suggest breaking the code down a bit anyways, its difficult to debug a step of that size.

It may also help to know that after the first occurrence of V_Sas_EmpMst_BFI.EmpName

There is a number 36 which is not valid.

Contributor BSL
Contributor
Posts: 25

Re: Problem with WHERE CLAUSE

Hi RW9,

I am already running the first part only but even that is not running with where clause however its running without error if i remove the WHERE condition.

-rahul

Super User
Super User
Posts: 7,988

Re: Problem with WHERE CLAUSE

And what happens (log report) if you just have the first part of the where:

WHERE   (vwInvoiceData_BFI.Iddepotcode = 'B000')

Does the above work, then do the same with the next part of the where clause.  Repeat until you find the problem statement.  I would imagine if it works without the where then in the where you have a variable which is not present in the given dataset, or has a different type.

Contributor BSL
Contributor
Posts: 25

Re: Problem with WHERE CLAUSE

First part itself has a problem, I couldn't proceed further and using the first part separately. Attached LOG.txt has the log for the first part only.

Ask a Question
Discussion stats
  • 6 replies
  • 360 views
  • 0 likes
  • 2 in conversation