Solved

Datawindow error

Posted on 2002-07-08
15
3,677 Views
Last Modified: 2013-12-26
I'm getting an error I have never seen before.

Datawindow error

Select Error: Column lists do not match

I've not seen this error before.

The DW in question had its Owner changed (from DBO), was a Sybase DB, and now is an Oracle 8i Database.

No other properties other than a join and the ownership were changed in the Datawindow,  now this error is poppin up.  On both the native retrieve, and when run through the application.

Any help would be appreciated.
0
Comment
Question by:valiant_at_mci
  • 4
  • 3
  • 2
  • +3
15 Comments
 

Author Comment

by:valiant_at_mci
ID: 7138737
This is a bit of a hurry if anyone could help please
0
 
LVL 2

Expert Comment

by:Caseys95
ID: 7140930
This is a problem with you select statement. Are you using a union? If so, look that both sideds of the union (all) have the same number of columns and that the column types match in both type and position.

If you can post the Select statement I may be of more help.

0
 
LVL 1

Expert Comment

by:levr
ID: 7141998
Try Export-Import
send DataWindow to me levrom@hotmail.com
I will examine it
0
 

Expert Comment

by:vikas1711
ID: 7142614
Have u tested the sql for the datawindow.
Does it works fine.
Please send the sql for DW .
Regards
vikas
0
 

Author Comment

by:valiant_at_mci
ID: 7146098
I found the problem with the DW, and its not in the SQL or the pull of the DW itself its the use of the MODIFY function to change the SQL behind the scenes.
But the initial problem remains, as the solution I devised did not work.

Before calling the Modify function I changed the single quotes (') to double (") around certain items (listed below), and this actually got past the column error that is a result of a bad Modify call.  The problem that arose from this change is that though the MODIFY function now modifies correctly, the DW gets an invalid Column error with Double "'s.

Catch 22.  Change the SQL to use the modify function, but then the DW wont retrieve properly.

Columns Changing:
Select < Various Coumns>,
To_Number( To_Char(FAST.account_request.requested_date, "mm") ),          
To_Number( To_Char(FAST.account_request.requested_date, "dd") ),          
To_Number( To_Char(FAST.account_request.requested_date, "yy") ),
InStr(FAST.account_request.status, "xndaper")

SQL comes from here:
is_orgselect = dw_list.Describe("DataWindow.Table.Select")

Changes are here:
is_orgselect = replace(is_orgselect, pos(is_orgselect, "'mm'"), 4, "~"mm~"")
is_orgselect = replace(is_orgselect, pos(is_orgselect, "'dd'"), 4, "~"dd~"")
is_orgselect = replace(is_orgselect, pos(is_orgselect, "'yy'"), 4, "~"yy~"")
is_orgselect = replace(is_orgselect, pos(is_orgselect, "'xndaper'"), 9, "~"xndaper~"")

t_modstrg = "DataWindow.Table.Select='"  &
               + is_orgselect + t_where + "'"

The entire SQL of the DW becomes what is below:

SELECT  FAST.ACCOUNT_REQUEST.~"SSO_LOGIN_ID~" ,           ~"FAST~".~"ACCOUNT_REQUEST~".~"CONNECT_ID~" ,           ~"FAST~".~"ACCOUNT_REQUEST~".~"REQUESTED_DATE~" ,           To_Number( To_Char(FAST.account_request.requested_date, "mm") ),           To_Number( To_Char(FAST.account_request.requested_date, "dd") ),           To_Number( To_Char(FAST.account_request.requested_date, "yy") ),           ~"FAST~".~"ACCOUNT_REQUEST~".~"STATUS~" ,           ~"FAST~".~"ACCOUNT_REQUEST~".~"REQUESTOR_LOGIN_ID~" ,           ~"FAST~".~"SSO_USER~".~"LAST_NAME~" ,           ~"FAST~".~"SSO_USER~".~"FIRST_NAME~" ,           ~"FAST~".~"SSO_USER~".~"MIDDLE_NAME~" ,           ~"FAST~".~"SSO_USER~".~"FIN_DEPT_ID~" ,           ~"FAST~".~"ACCOUNT_REQUEST~".~"APPROVER_LOGIN_ID~" ,           ~"FAST~".~"SSO_USER~".~"SU_ID~" ,           ~"FAST~".~"ACCOUNT_REQUEST~".~"STATUS_DATE~" ,           ~"FAST~".~"DEPARTMENT~".~"DEPT_NAME~" ,           ~"FAST~".~"CONNECTION~".~"SHORT_DESC~" ,           InStr(FAST.account_request.status,"xndaper")    FROM ~"FAST~".~"ACCOUNT_REQUEST~" ,           ~"FAST~".~"SSO_USER~" ,           ~"FAST~".~"CONNECTION~" ,           ~"FAST~".~"DEPARTMENT~"     WHERE ( ~"FAST~".~"SSO_USER~".~"FIN_DEPT_ID~" = ~"FAST~".~"DEPARTMENT~".~"DEPT_NUMBER~" (+)) and          ( ~"FAST~".~"ACCOUNT_REQUEST~".~"SSO_LOGIN_ID~" = ~"FAST~".~"SSO_USER~".~"SSO_LOGIN_ID~" ) and          ( ~"FAST~".~"ACCOUNT_REQUEST~".~"CONNECT_ID~" = ~"FAST~".~"CONNECTION~".~"CONNECT_ID~" )    and (FAST.account_request.status in ("r", "e"))'
0
 

Author Comment

by:valiant_at_mci
ID: 7146103
Forgot to mention.  Still seeking some kind of solution to this.  Fixing the initial error produces the DW Invalid Column error (Oracle 8i).  So I am sort of stuck.  Other than making another DW with the modified SQL as a base and switching out the properties on the one displayed.  
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 2

Expert Comment

by:Caseys95
ID: 7147402
valiant,

Changing the single quotes to double quotes will not fix your problem but just create another. The double quotes identify database objects. The single quotes designate the start and end of strings. This would generate the invalid column error. Oracle would assume "mm", "dd", "yy", "xndaper", "r" and "e" to all be names of columns.

These are the errors in your select SQL

1) To_Number( To_Char(FAST.account_request.requested_date, "mm") ),  
The "mm" should be 'mm'        

2) To_Number( To_Char(FAST.account_request.requested_date, "dd") ),          
The "dd" should be 'dd'        

3) To_Number( To_Char(FAST.account_request.requested_date, "yy") ),          
The "yy" should be 'yy'

4) InStr(FAST.account_request.status,"xndaper")
The "xndaper" should be 'xndaper' though "xndaper" may be a column name.

5) FAST.account_request.status in ("r", "e"))'
The "r", "e" should be 'r', 'e' and the trailing ' should not be there

I think thats it.

A) Why do you think you need to change the single to double quotes?
B) Did you always manipulate the SQL prior to the retrieve?
c) Instr will return a number. Is this what your looking for in the last column expression?

0
 

Author Comment

by:valiant_at_mci
ID: 7164661
The DW actually has no criteria for when it was built (I am not the author).  

Based on who is pulling information (their access level), certain filters are tacked on with a MODIFY command.  The sinlge quotes will not go through the Modify command, and doubles aren't recognized by Oracle.  The singles (along your theme), were the solution by prefacing them with ~~

0
 
LVL 2

Accepted Solution

by:
Caseys95 earned 200 total points
ID: 7172894
One last comment:

Check out the Powerbuilder help for 'SetSQLSelect()' There are a few good reasons to use this function over the "Modify()" technique. One being that it is easier to handle special characters such as "'" and '"'.

From the help text

"Modify will not verify the SELECT statement or change the update information, making it faster but more susceptible to user error. Although you can use Modify when arguments are involved, it is not recommended because of the lack of checking."

http://manuals.sybase.com/onlinebooks/group-pb/pbg0702e/dwref/@Generic__BookView;pt=40235?DwebQuery=setsqlselect

You could also do:
dw_1.object.datawindow.table.select = 'Select ... Where ...'
This option is much like the modify() function but you will not have to mess with the tildas.

http://manuals.sybase.com/onlinebooks/group-pb/pbg0702e/dwref/@Generic__BookView;pt=46477?DwebQuery=table.select
0
 
LVL 3

Expert Comment

by:hink
ID: 7394386
Column list defined in the datawindow doesn't match with the select command. The most often reasons:

1) Select contains * (all columns) and table was changed.
2) Select references view, original table was changed, and view was not recreated. The column types are shifted.
0
 

Expert Comment

by:BenRosales
ID: 13347510
Okay I just had the same/similar problem and then read through this.  Based, on Hinks comment from Date: 10/31/2002 02:51PM PST, I derived a solution.

PB version 5. ( Iit old I know but we have a huge application that uses a Framework based on PB 5 that cannot be upgraded.)

My data and SQL ( actually a stored proc ) had both gone through several revisions. However, I did not want to lose all the formatting work in the existing dw.  I never saw the problem while previewing, the dw from PB, only when I ran it from the App. A slight difference for me was my owner did not change....just had a lot of revisions in DW and SP.

Here is what I did.  I decided to build a new temp DW.  And then I compared the columns and data specs from the new one to the old one.  Sure enough, there was a minor difference.  Once I made the old DW match the new DW column specs, It worked fine.

Hope this helps others.



0
 
LVL 3

Expert Comment

by:hink
ID: 13352681
I PB, You don't need to create new datawindow, when datatypes are set wrongly. It is enough to change anything in its SQL select, for example add and a space in the command or deselect any column and select again. When You will return to design, the datatypes are OK.
0
 

Expert Comment

by:BenRosales
ID: 13575852
I did not realize I missed this until I was cleaning out my email.   Thanks hink I will try this net time.

BR

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now