Contatination string with number

Hi,
i have to concatinate string with number
like
create or replace
PROCEDURE sp1(
p1 NUMBER DEFAULT NULL
as
v_numId number(7,0)
begin
if v_numId is not null then
--1)v_nstrQuery:='select * from abc where id=' || v_numId;
--or
-2)-v_nstrQuery:='select * from abc where id=' || cast( v_numId as varchar2);
end
else
v_nstrQuery:='select * from abc ' ;
end if;
begin
EXECUTE IMMEDIATE v_nstrQuery INTO v_strMeasurementBasis1;
end;
end;
1) which one i should use from 1 and 2
2) i also noticed that , it show blue curly line under varchar2 of line second saying. "syntex error expected : identifer number_datatype number"
2) i noticed that begin and end; srounding execute immediate
is not required , please suggenst should i use it or not.
yours sincerly.

See iin bold below
create or replace
PROCEDURE sp1(
p1 NUMBER DEFAULT NULL
as
v_numId number(7,0)
begin
if v_numId is not null then
--1)v_nstrQuery:='select * from abc where id=' || v_numId;
--or
-2)-v_nstrQuery:='select * from abc where id=' || cast( v_numId as varchar2);
end
else
v_nstrQuery:='select * from abc ' ;
end if;
begin
EXECUTE IMMEDIATE v_nstrQuery INTO v_strMeasurementBasis1;
end;
end;
1) which one i should use from 1 and 2 first oneis fne, no need to cast to varchar2
2) i also noticed that , it show blue curly line under varchar2 of line second saying. "syntex error expected : identifer number_datatype number"
2) i noticed that begin and end; srounding execute immediate if you need to write / handle any exception begin and end should be there
is not required , please suggenst should i use it or not.
Edited by: Kiran on Dec 21, 2012 1:45 AM

Similar Messages

  • How Can I replace newScale Text Strings with Custom Values?

    How Can I replace newScale Text Strings with Custom Values?
    How can I replace newScale text strings with custom values?
    All  newScale text is customizable. Follow the procedure below to change the  value of any text string that appears in RequestCenter online pages.
    Procedure
    1. Find out the String ID of the text string you would like to overwrite by turning on the String ID display:
    a) Navigate to the RequestCenter.ear/config directory.
    b) Open the newscale.properties file and add the following name-value pair at the end of the file:res.format=2
    c) Save the file.
    d) Repeat steps b and c for the RmiConfig.prop and RequestCenter.prop files.
    e) Stop and restart the RequestCenter service.
    f) Log  in to RequestCenter and browse to the page that has the text you want  to overwrite. In front of the text you will now see the String ID.
    g) Note down the String ID's you want to change.
    2. Navigate to the directory: /RequestCenter.ear/RequestCenter.war/WEB-INF/classes/com/newscale/bfw.
    3. Create the following sub-directory: res/resources
    4. Create the following empty text files in the directory you just created:
    RequestCenter_0.properties
    RequestCenter_1.properties
    RequestCenter_2.properties
    RequestCenter_3.properties
    RequestCenter_4.properties
    RequestCenter_5.properties
    RequestCenter_6.properties
    RequestCenter_7.properties
    5. Add the custom text strings to the appropriate  RequestCenter_<Number>.properties file in the following manner  (name-value pair) StringID=YourCustomTextString
    Example: The StringID for "Available Work" in ServiceManager is 699.
    If you wanted to change "Available Work" to "General Inbox", you  would add the following line to the RequestCenter_0.properties file
         699=General Inbox
    Strings are divided into the following files, based on their numeric ID:
    Strings are divided into the following files, based on their numeric ID:
    String ID  File Name
    0 to 999 -> RequestCenter_0.properties
    1000 to 1999 -> RequestCenter_1.properties
    2000 to 2999 -> RequestCenter_2.properties
    3000 to 3999 -> RequestCenter_3.properties
    4000 to 4999 -> RequestCenter_4.properties
    5000 to 5999 -> RequestCenter_5.properties
    6000 to 6999 -> RequestCenter_6.properties
    7000 to 7999 -> RequestCenter_7.properties
    6. Turn off the String ID display by removing (or commenting out) the line "res.format=2" from the newscale.properties, RequestCenter.prop and RmiConfig.prop files
    7. Restart RequestCenter.
    Your customized text should be displayed.

    I've recently come across this information and it was very helpful in changing some of the inline text.
    However, one place that seemed out of reach with this method was the three main buttons on an "Order" page.  Specifically the "Add & Review Order" button was confusing some of our users.
    Through the use of JavaScript we were able to modify the label of this button.  We placed JS in the footer.html file that changes the value of the butt

  • Can I encrypt a string with RSA encryption using DBMS_CRYPTO?

    We have an web application that does a redirect thru a database package to a 3rd party site. They would like us to encrypt the querystring that is passed using RSA encryption. The example that they've given us (below) uses the RSA cryptographic service available in .NET. Is it possible to do this using DBMS_CRYPTO or some other method in Oracle?
    Below are the steps outlined to use the key to generate the encrypted URL
    2.1 Initialize Service
    The RSA cryptographic service must be initialized with the provided public key. Below is sample code that can be used to initialize the service using the public key
    C#
    private void InitializeRSA( string keyFileName )
    CspParameters cspParams = new CspParameters( );
    cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
    m_sp = new RSACryptoServiceProvider( cspParams );
    //Load the public key from the supplied XML file
    StreamReader reader = new StreamReader( keyFileName );
    string data = reader.ReadToEnd( );
    //Initializes the public key
    m_sp.FromXmlString( data );
    2.2 Encryption method
    Create a method that will encrypt a string using the cryptographic service that was initialized in step 2.1. The encryption method should convert the encryption method to Base64 to avoid special characters from being passed in the URL. Below is sample code that uses the method created in step 2.1 that can be used to encrypt a string.
    C#
    private string RSAEncrypt( string plainText )
    ASCIIEncoding enc = new ASCIIEncoding( );
    int numOfChars = enc.GetByteCount( plainText );
    byte[ ] tempArray = enc.GetBytes( plainText );
    byte[ ] result = m_sp.Encrypt( tempArray, false );
    //Use Base64 encoding since the encrypted string will be used in an URL
    return Convert.ToBase64String( result );
    2.3 Generate URL
    The query string must contain the necessary data elements configured for you school in Step 1. This will always include the Client Number and the Student ID of the student clicking on the link.
    1.     Build the query string with Client Number and Student ID
    C#
    string queryString = “schoolId=1234&studentId=1234”;
    The StudentCenter website will validate that the query string was generated within 3 minutes of the request being received on our server. A time stamp in UTC universal time (to prevent time zone inconsistencies) will need to be attached to the query string.
    2.     Get the current UTC timestamp, and add the timestamp to the query string
    C#
    string dateTime = DateTime.UtcNow.ToString(“yyyy-MM-dd HH:mm:ss”);
    queryString += “&currentDT=” + dateTime;
    Now that the query string has all of the necessary parameters, use the RSAEncrypt (Step 2.2) method created early to encrypt the string. The encrypted string must also be url encoded to escape any special characters.
    3.     Encrypt and Url Encode the query string
    C#
    string rsa = RSAEncrypt(querystring);
    string eqs = Server.UrlEncode(rsa);
    The encrypted query string is now appended to the Url (https://studentcenter.uhcsr.com), and is now ready for navigation.
    4.     Build the URL
    C#
    string url = “https://studentcenter.uhcsr.com/custom.aspx?eqs=” + eqs

    The documentation lists all the encyrption types:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_crypto.htm#ARPLS664

  • Is there an easy way to convert from a String with a comma, ie. 1,000.00 to

    Is there an easy way to convert from a String with a comma, ie. 1,000.00 to a float or a double?
    thanks,
    dosteov

    Like DrClap said: DecimalFormat. However, make sure you understand the Locale things, as explained at http://java.sun.com/j2se/1.3/docs/api/java/text/DecimalFormat.html (which refers to NumberFormat as well) and use them explicitly. Like
    public class FormatTest
      public static void main(String args[])
        try
          // see NumberFormat.getInstance()
          DecimalFormat fmt = new DecimalFormat();
          Number num = fmt.parse("1,000.01");
          System.out.println(num.doubleValue());
        catch(ParseException pe)
          System.out.println(pe);
    }most likely seems OK on your system, but may print "1.0" (or even fail) on some non-English platforms!
    When performing calculations, also see http://developer.java.sun.com/developer/JDCTechTips/2001/tt0807.html
    a.

  • How to create a String with a specific size?

    how to create a String with a specific size?
    For example I want to create different Strings with the size of 100 , 1000 or 63k byte?

    String are immutable so just initialize it with the number of characters you want.
    You might want to look at java.lang.StringBuffer and see if that's what you want.

  • How to print a string with out using main method??

    how to print a string with out using main method??
    if we can tell me with example?
    thanks in adavance
    raja

    Hi,
    actually there's none. The UITableView class needs to "know" the tableView's height so either it can calc <number of rows> times <row height> or it has to sum the height of each single row.
    If the row which needs to be of different size always is the first or the last row you can user a tableHeader or tableFoot view.
    Regards
    Dirk

  • Formatting a string with Display String

    I have a field in my database that is a string with numbers in it and I need it formatted like so: "xx-xx-xx-xxx" nine characters long.
    For example: 92438014
    I need it to look like: 09-24-38-014
    and
    141234892
    14-12-34-892 etc..
    can anyone help me with some code that will do this for me? I'm not the best at crystal custom formatting.
    thank you
    Edited by: MarcieHennessy on Oct 14, 2009 10:47 PM

    Raghavendra.G
    I was on this site searching for an answer to my problem, and you provided the solution for me with your response to the above.  However, my problem was a bit different.  I needed a way to format a 9-digit number string into a standard Social Security number format.  I used your formula from above, and WOW - it worked!  If I could award you double Forum Points, I would.  But, since I can't do that, I will just say thanks, and ask God to bless you profusely.
    Kathryn J. Ryan.

  • Ho to Comapre with Number Data Type

    hi
    My reqt is to do validation in ValidateEntity Method.
    How to compare the with Number Data type:
    For ex: Number a = gatAbc();
    If(a>10)
    throw new oaExcption...
    But while comapring i got compiler Error
    Error(218,17): method >(oracle.jbo.domain.Number, int) not found in class abc.oracle.apps.per.irc.pqr.schema.server.XxabcEOImpl
    So plz tell me how to compare the integer value with Number data type
    Thanx

    Check with float. It will work definitely.
    float number = Float.parseFloat(HrsPerDay); //HrsPerDay is a String and I am converting it to float
    if(( number <= 0) || (number >= 21))
                            throw new OAAttrValException(OAAttrValException.TYP_VIEW_OBJECT,
                                              "xxCopyResourceVO1",
                                              rowi.getKey(),
                                              "NoOfCopies",
                                              rowi.getAttribute("NoOfCopies"),
                                              "PA",
                                              "xx_xx_COPY_POSITIVE_NUM");
                       }Here in this code i am also checking that the Hours cannot be less then 0 and greater than 20.
    Thanks
    --Anil                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Logic for correcting strings with different barckets

    can any one tell me the simple logic for correcting strings with different barckets
    suppose say for eg.
    (<{abc}>defgh) should evaluate to TRUE
    (<{abc>} should evaluate to FALSE
    Things to check is
    1. number of opening brace and closing brace
    2. Their position are correct or not
    If the above two conditions are met than it is TRUE else FALSE
    i guess string function with decode and lenght function or case should do but bit difficult to develop this logic in with sql
    Thanks,
    AAK

    Hi,
    Here is non REGEXP_REPLACE version ( Unfotunately dont have 10G to feel the power of REGEXP_REPLACE.
    SQL> ed
    Wrote file afiedt.buf
      1  SELECT DECODE(SUM(CASE
      2                    WHEN Left = '(' AND Right =')' THEN 0+Count_Bracket
      3                    WHEN Left = '<' AND Right ='>' THEN 0+Count_Bracket
      4                    WHEN Left = '{' AND Right ='}' THEN 0+Count_Bracket
      5                    WHEN Left = '[' AND Right =']' THEN 0+Count_Bracket
      6                    ELSE
      7                       1
      8                    END
      9                    )
    10         ,0,'Valid','Invalid')
    11  FROM
    12  (
    13     SELECT SUBSTR(str,(len+1 - level),1) Left, SUBSTR(str,(len + level),1) Right, MOD(LENGTH(str),2)
    14     FROM
    15     (
    16      SELECT
    17         REPLACE(translate('&exp','abcdefgh','        '),' ') str,
    18         LENGTH(REPLACE(translate('&exp','abcdefgh','        '),' '))/2 len
    19      FROM DUAL
    20    )
    21    CONNECT BY LEVEL <= LEN
    22* )
    SQL> /
    Enter value for exp: (<{abc>} )
    old  17:        REPLACE(translate('&exp','abcdefgh','        '),' ') str,
    new  17:        REPLACE(translate('(<{abc>} )','abcdefgh','        '),' ') str,
    Enter value for exp: (<{abc>} )
    old  18:        LENGTH(REPLACE(translate('&exp','abcdefgh','        '),' '))/2 len
    new  18:        LENGTH(REPLACE(translate('(<{abc>} )','abcdefgh','        '),' '))/2 len
    DECODE(
    Invalid
    SQL>
    SQL> /
    Enter value for exp: <{[()]}>
    old  17:        REPLACE(translate('&exp','abcdefgh','        '),' ') str,
    new  17:        REPLACE(translate('<{[()]}>','abcdefgh','        '),' ') str,
    Enter value for exp: <{[()]}>
    old  18:        LENGTH(REPLACE(translate('&exp','abcdefgh','        '),' '))/2 len
    new  18:        LENGTH(REPLACE(translate('<{[()]}>','abcdefgh','        '),' '))/2 len
    DECODE(
    Valid
    SQL>
    SQL> /
    Enter value for exp: ([{<>}])
    old  17:        REPLACE(translate('&exp','abcdefgh','        '),' ') str,
    new  17:        REPLACE(translate('([{<>}])','abcdefgh','        '),' ') str,
    Enter value for exp: ([{<>}])
    old  18:        LENGTH(REPLACE(translate('&exp','abcdefgh','        '),' '))/2 len
    new  18:        LENGTH(REPLACE(translate('([{<>}])','abcdefgh','        '),' '))/2 len
    DECODE(
    Valid
    SQL>
    SQL> /
    Enter value for exp: (<{abc}>defgh)
    old  17:        REPLACE(translate('&exp','abcdefgh','        '),' ') str,
    new  17:        REPLACE(translate('(<{abc}>defgh)','abcdefgh','        '),' ') str,
    Enter value for exp: (<{abc}>defgh)
    old  18:        LENGTH(REPLACE(translate('&exp','abcdefgh','        '),' '))/2 len
    new  18:        LENGTH(REPLACE(translate('(<{abc}>defgh)','abcdefgh','        '),' '))/2 len
    DECODE(
    Valid
    SQL> Note: Only thing needs to care is " translate('<{[()]}>','abcdefgh',' ') " if string has some additional characters please include here.
    Regards

  • Converting string to number

    Why the number doesn't contain the whole string and how to solve it ? 
    VI is attached
    Solved!
    Go to Solution.
    Attachments:
    String to number.vi ‏7 KB

    MarinaNashaat wrote:
    binary bits
    What does that even mean?
    Post a screenshot of your VI with the data typed in.  Or put the data in the control.  Right click and save the value as defaul.  Save the VI and attach that.
    (Please put all of your information in one post.  No need to create another message.  You can even edit your previoius message within a reasonable period of time if you go to the options menu to the right of the message and choosed Edit Reply.

  • Owa_text.vc_arr: can't handle the string with more than 4000 characters?

    In the Oracel Web Application Server 4.0 documment, it says
    about owa_text.vc_arr :Type vc_arr is table of varchar2(32767)
    index by binary_integer.
    I amusing PL_SQL with Oracle8i and OWA4.0 web server.I want to
    use owa_text.vc_arr to pass the multple line texts in my form.
    If the text length is less than 4000 characters, everything works
    fine.However when the texts are longer than 4000 characters but
    less than the max length 32767 characters, I got this error
    message:
    OWS-05101: Execution failed due to Oracle error 2005
    ORA-02005: implicit (-1) length not valid for this bind or define
    datatype.
    Owa_text.vc_arr is supposed to handle the string with more
    than 4000 characters, is it true? Could anyone tell me why? Any
    help will be greatly appreciated!!!
    Thanks very much.
    Helena Wang
    Here is the pl_sql procedure to create my form:
    PROCEDURE myform
    IS
    BEGIN
    htp.p('
    <form action="'||service_path||'helena_test.saveform3"
    method=post>
    <input type=hidden name=tdescription value="X">
    Input1: <textarea name=tdescription rows=50 cols=70
    WRAP=physical></textarea>
    Input2: <textarea name=tdescription rows=50 cols=70
    WRAP=physical></textarea>
    <input type=submit name=WSave value="Save">
    </form>
    END;
    /***** here is the pl_sql procedure which I use to save the
    form***/
    procedure saveform3(tdescription in owa_text.vc_arr,
    WSave in varchar2 default 'No')
    is
    len pls_integer;
    begin
    for i in 2..tdescription.count loop
    len := length(tdescription(i));
    htp.p(len);
    htp.p(tdescription(i));
    end loop;
    end;

    Helena, I think you might get a better response either from the SQL-PL/SQL forum, or perhaps the Portal Applications forum - both of these tend to have folks very familiar with PL/SQL and the OWA packages.
    This forum is on Web services based on SOAP, WSDL and UDDI. These can be PL/SQL based but typically don't use the mod_psql or OWA web solution.
    As a pointer, I suspect you may already be familiar with, but just in case, you can always take a look at chapter 3 of the OAS documentation, "Developer's Guide: PL/SQL and ODBC Applications" where they go through a number of examples using parameters. See:
    http://technet.oracle.com/doc/appsrvr4082/guides/plsql.pdf
    Hope this or folks from the other list can help.
    Mike.

  • QBE Error when query by String for Number column

    Hi,
    I have a table with Number column.
    The column structure is like below:
    <af:column>
    <af:inputText>
    <f:validator .../>
    <af:converNumber ..../>
    </af:inputtext>
    </af:column>
    QBE is enabled for this column.
    It works fine when query by Number value, such as '123'. But when I query by string like 'asd', it will return an error.
    Anyone met this problem?

    Hi Arun,
    I am using Jdev 11.1.1.7.0.
    In my case,
    I have a application table, from where user can create new row inline. Some fields in the row have type Long or Number. We are also using <af:converNumber ..../> inside <af:inputText> to do format.
    I do have a query panel above the table. But we want the user can also filter the records using QBE. Other columns are working fine, except the columns with type 'Number' or 'Long'.
    I checked the incident log, below are some useful information:
    Caused by: java.sql.SQLSyntaxErrorException: ORA-01722: invalid number
    Caused by: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT ... FROM ... WHERE ... AND ( ( (MeaRulesEO.DEFAULT_MEA_PERIOD = :vc_temp_1 ) ) )
    It seems 'MeaRulesEO.DEFAULT_MEA_PERIOD = :vc_temp_1' causes the error. Jdev assumes every input from QBE header as number. If String is entered, Jdev will return error.
    I also checked that if the table is read-only, this problem does not exist.
    Please help on this. Thank you.

  • Time stamps to string with seconds

    Good Day
    Im writing a program for my DAQ system. Its required that my
    data is saved with hours, mins and secs. The get date/time
    string VI seems to only output a string with the date and with
    hours and minutes. 
    How would I include the seconds into the outputed string.
    Thank You for your time.

    The vi has an boolean input 'want seconds' default is FALSE. Wire a TRUE and your done
    For a more flexible output there is also the
    Format Date/Time String Function
    Owning Palette: String Functions
    Requires: Base Package
    Displays a timestamp value or a numeric value as time in the format you specify using time format codes. For example, %c displays locale-specific date/time. Time-related format codes include the following: %X (locale-specific time), %H (hour, 24-hour clock), %I (hour, 12-hour clock), %M (minute), %S (second), %<digit>u (fractional seconds with <digit> precision), and %p (a.m./p.m. flag). Date-related format codes include the following: %x (locale-specific date), %y (year within century), %Y (year including century), %m (month number), %b (abbreviated month name), %d (day of month), and %a (abbreviated weekday name).
    Details  
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • Fract/Exp String to Numbe Display Format

    I have a Numeric String which has a large decimal value, with the Digits of precision ranging upto 16 digits. I want to convert this String to a Numeric value and I have used a 'Fract/Exp String to Number'. In my VI I hae set:
    Data Type: EXT (because it allows Number of Decimal Digits from 15 to 20)
    Data Format: Floting Point
    Digits: 16
    Precision Type: Precision Digits
    The following is my question: If the input string has Precision Digits = 15 Eg: 5.369607712106161
    Then I am getting output = 5.3696077121061609, which is about the same, but not the same number I sent.
    or , String 1.145152879691825 gives me number = 1.1451528796918251
    String 5.818356760119754 gives me number = 5.8183567601197543
    Please suggest how I can make the output more precise. 
    Thank you.
    Regards,
    H.
    Solved!
    Go to Solution.
    Attachments:
    FractStringToNumber.vi ‏6 KB

    Hello Darin
    Thank you for the post. It worked!
    I do not understnd one thing: My  output number is EXT and the default value is also EXT with precision value set to 0. How does wiring the default value itself works, while not wiring it didnt work before!
    Thanks,
    H
    Message Edited by H P on 12-17-2009 03:45 PM
    Attachments:
    FractStringToNumber.vi ‏7 KB

  • Take the average of the measured values wich cannot be converted from string to number..

    Hello,
    I have a Keithley 182 Digital Nanometer (K182). I am usins it to measure voltage at high temperature. I want K182 to measure 3 times and then take the avarage of collected data.
    1. First problem is, as you can see from picture, string to number conversion. I tried many ways but I couldn't do it. Values as you see 0,00, and once was
    3,98E-3
    0,00
    392,0
    originan values were
    3,98E-3
    3,95E-3
    3,93E-3
    in table, values generally like this.
    2. I need to take avarege. So i need toindez data, then take avarage. So, I have also problem here...
    Could you please help on thic topic. Thanks in advance.
    Attachments:
    string-number.png ‏19 KB
    string-number-panel.png ‏30 KB

    thank you, I will try this solution. Also I want to do one more thing. So, I am collecting data and putting them in to table let say data are like this
    Temp1     Temp2   Volt
    123,3       234,5      ...
    234,4       567,7
    345,6       789,9
    456,7       678,8
    I want to put data with increment like this given below:
    No  Temp1     Temp2   Volt
    1    123,3       234,5      ...
    2    234,4       567,7    
    3    345,6       789,9
    4    456,7       678,8
    there are no exact number of data. the number of data can change from measurement to measurement (1000, 2000, 500 more or less). How can I program this increment in my system.
    My system is include LakeShore 336 temperature conroller and Keithley 182 Nanovoltmeter. I will set the temperature specified value from room temperature wtih specific ramp rate. Meanwhile I will measure the voltage from sample via K182. So, I can measure both temp, and voltage via taking help from u.

Maybe you are looking for