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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

STR function ??

Status
Not open for further replies.

dkwong

MIS
Dec 27, 2001
76
0
0
CA
Could somebody tell me what the STR function does?
e.g. STR(lineItem,2,0
STR(purreq->totalCost,12,2)

Is there an equivalent function in Oracle PL/SQL?
 
What language did you find this function in? dBase, FoxPro, VB... First check the language reference for it and if that fails, check to see if its a User Defined Function (UDF) in the program. It may be hidden at the bottom of the program or in a calling program. Happy hunting.
 
This function is used in a dBase program. I cannot find it in any language reference and I don't think it's a user-defined function. Any ideas?
 
The STR function turns a numeric value into a character string. It's most useful when printing or displaying strings that contain numeric values:

Your daily balance is $125.00

could be doen like this:

text1 = "Your daily balance is $" + str(125.00)

text1 will display Your daily balance is $125.00

There's always a better way...
 
STR(nMyExpression [, nMyLength [, nMyDecimalPlaces]])

nLength specifies the length of the character string STR( ) returns. The length includes one character for the decimal point and one character for each digit to the right of the decimal point. Defaults to 10 if excluded.

nDecimalPlaces specifies the number of decimal places in the character string STR( ) returns. Defaults to zero if excluded.

I believe Oracle SQL has a function called to_char() that fulfills a similar role. I will double-check this when I get home (where my PL/SQL manual is at the moment).

Hope this helps.
 
Yep, to_char(numeric_expression) does the similar function in PL/SQL.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top