Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the SQL equivalent of this Oracle code? 1

Status
Not open for further replies.

HiBoo

Programmer
Jan 11, 2000
88
CA
I'm trying to convert the following Oracle code to SQL. Could you please help? I've got no documentation on Oracle functions to explain how they work.

substr(BRANCH, -1, 1) || substr(REGISTERNUMBER, -3, 3);

In Oracle, the BRANCH attribute is a VARCHAR(4) and the REGISTERNUMBER is a VARCHAR(6). The SQL attributes are of the same datatype.

I know that the SQL version s/b SUBSTRING(branch,?,?) + SUBSTRING(registernumber,?,?) but I'm not sure of the proper numbers.

Thanks for any input...
 
You should be able to use

SUBSTRING(BRANCH, [STARTING POSITION], [ENDING POSITION])

SUBSTRING(REGISTERNUMBER, [STARTING POSITION], [ENDING POSITION]

I guess it depends on what you are extracting the data for.

tgriffin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top