Solved

Variable type conversion in where clause

Posted on 2008-06-23
3
153 Views
Last Modified: 2010-03-20
Hi,

I have the attached as part of my WHERE clause
 
 The "GL_Calendar_Details_"."Fiscal_Period_"  and  "GL_Calendar_Details_"."Fiscal_Year_" fields are int32.

I am not getting any results returned probably because the MONTH and YEAR functions are returning a varchar type.  How can I modify my code?

Thanks,
Bruce
and "General_Ledger_Transactions_"."DB-NAME"	               = "GL_Calendar_Details_"."DB-NAME"
   and MONTH("General_Ledger_Transactions_"."Effective_Date_") = "GL_Calendar_Details_"."Fiscal_Period_"
   and YEAR("General_Ledger_Transactions_"."Effective_Date_") = "GL_Calendar_Details_"."Fiscal_Year_"
   and "General_Ledger_Transactions_"."Entity_" = "GL_Calendar_Details_"."Entity_"

Open in new window

0
Comment
Question by:pelicansys
  • 2
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 21847938
>because the MONTH and YEAR functions are returning a varchar type
no, the do return integer data also.

can you show the full table creation script, please?
0
 

Author Comment

by:pelicansys
ID: 21849150
Attached is the complete select stmt.

Thanks
select "General_Ledger_Transactions_"."DB-NAME" + '-' + "General_Ledger_Transactions_"."Account_" as "Account_Unique_",
       "General_Ledger_Transactions_"."Project_" as "Project_",
       "General_Ledger_Transactions_"."Entity_" as "Entity_",
       "General_Ledger_Transactions_"."Account_" as "Account_",
       "General_Ledger_Transactions_"."Transaction_Amount_SRC_" as "Transaction_Amount_SRC_",
       "General_Ledger_Transactions_"."Transaction_Amount_DW_" as "Transaction_Amount_DW_",
       "General_Ledger_Transactions_"."Transaction_Amount_TX_" as "Transaction_Amount_TX_",
       "General_Ledger_Transactions_"."DB-NAME" as "DB-NAME",
       "Accounts_"."Account_Type_" as "Account_Type_",
       "Accounts_"."Account_Description_" as "Account_Description_",
       "Accounts_"."Account_" + ' (' + "Accounts_"."Account_Description_" + ')' as "Account+Description",
       "Entities_"."Entity_Name_" as "Entity_Name_",
       "Sub_Accounts_"."Sub_Account_" as "Sub_Account_",
       "Sub_Accounts_"."Sub_Account_Description_" as "Sub_Account_Description_",
       "Cost_Centers_"."Cost_Center_" as "Cost_Center_",
       "Cost_Centers_"."Cost_Center_Description_" as "Cost_Center_Description_",
       "Base_Currency_"."Currency_" as "Currency_",
       "General_Ledger_Transactions_"."Effective_Date_" as "Effective_Date_",
	MONTH("General_Ledger_Transactions_"."Effective_Date_") as "Fiscal_Period_",
	YEAR("General_Ledger_Transactions_"."Effective_Date_") as "Fiscal_Year_",
	"General_Ledger_Transactions_"."DB-NAME" as "DB-NAME"
      
from   "PUB"."General_Ledger_Transactions_",
       "PUB"."Base_Currency_",
       "PUB"."Cost_Centers_",
       "PUB"."Sub_Accounts_",
       "PUB"."Entities_",
       "PUB"."Accounts_",
       "PUB"."GL_Calendar_Details_",
       "PUB"."GL_Calendar_" 	
 
where  "General_Ledger_Transactions_"."DB-NAME"             = "Base_Currency_"."DB-NAME" (+)
 
   and "General_Ledger_Transactions_"."DB-NAME"             = "Cost_Centers_"."DB-NAME" (+)
   and "General_Ledger_Transactions_"."Cost_Center_"        = "Cost_Centers_"."Cost_Center_" (+)
 
   and "General_Ledger_Transactions_"."DB-NAME"             = "Sub_Accounts_"."DB-NAME" (+)
   and "General_Ledger_Transactions_"."Sub_Account_"        = "Sub_Accounts_"."Sub_Account_" (+)
 
   and "General_Ledger_Transactions_"."DB-NAME"             = "Accounts_"."DB-NAME" (+)
   and "General_Ledger_Transactions_"."Account_"            = "Accounts_"."Account_" (+)
   and "General_Ledger_Transactions_"."Account_"            = '21000'
 
   and "General_Ledger_Transactions_"."DB-NAME"	               = "GL_Calendar_Details_"."DB-NAME" (+) 
   and MONTH("General_Ledger_Transactions_"."Effective_Date_") = "GL_Calendar_Details_"."Fiscal_Period_" (+)
   and YEAR("General_Ledger_Transactions_"."Effective_Date_") = "GL_Calendar_Details_"."Fiscal_Year_" (+)
   and "General_Ledger_Transactions_"."Entity_" = "GL_Calendar_Details_"."Entity_"
 
 

Open in new window

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 21849181
which is not what I asked for :)
note: try to get "updated" on the OUTER JOIN syntax, the (+) stuff is
1) quite unreadable
2) subject to get less performant results

however, it shall not influence the results of the query.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

816 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

10 Experts available now in Live!

Get 1:1 Help Now