OPEN-FOR, varchar and nvarchar (more questions)

hello
create or replace function fnEnumSystemUser
+(+
+FirstNameFilter nvarchar2,+
+...+
+)+
RETURN xxxxx.cursorType /* REF-CURSOR */
AS
+strSQL varchar(2000);+
SystemUserCursor   xxxxxcursorType;
BEGIN
+...+
+open SystemUserCursor FOR strSQL using FirstNameFilter;+
+...+
Notice that FirstNameFilter type = nvarchar2 and strSQL type=varchar - if "FirstNameFilter" contains Asian character, then I presume it'd become jibberish in "strSQL"? And also lost any unicode data in OPEN-FOR operation?
(Actually I don't know what exactly will happen, at least not until I test with the app which is not yet read. And you can't call the function with unicode character with TOAD and didnt manage to get around test this with SQL*Plus yet.)
Thanks

Presumption incorrect.
From the link given by hoek in your original post this morning:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/datatypes.htm#sthref753
"You can interchange VARCHAR2 and NVARCHAR2 values in statements and expressions".
The NVARCHAR2 only really comes into things with table column datatypes for unicode data in non unicode character set.
If you're using a unicode character set (which you can find from info given in your third post), then you don't need to worry about NVARCHAR2 vs VARCHAR2 even when you're storing data.
If you use VARCHAR2 with multi-byte characters then you just need to make sure that you're using CHAR length semantics (NLS_LENGTH_SEMANTICS).
When you're fetching the data back into variables, you don't need to worry about VARCHAR2 and NVARCHAR2. As I already mentioned in previous threads, the datatype of the dynamically constructed query string passed into OPEN FOR has nothing to do with the datatypes returned by that query.
Going forward, if you do have issues with character set conversions and question marks then you need to look at character set conversions at the various touch points of your application, look at the NLS settings for the client(s) and server. Also the DUMP function is invaluable for seeing the bytes which are actually stored in a column / passed around.
From your first post, you gave the impression you were using bind variables for the parameters, this is good. For this sort of query building you might also want to look at SYS_CONTEXT for a slightly different way for binding your variables into your query string. There are a couple of useful asktom articles on this sort of thing.
So, in summary:
- you don't need to worry about using a NVARCHAR2 for the datatype of a PLSQL variable when just using that variable as a string for OPEN FOR
- if you are using a unicode character set, you don't need to worry about NVARCHAR2 vs VARCHAR2 for your column storage
- if you are using a non-unicode character set, you do need to worry about NVARCHAR2 vs VARCHAR2 for your column storage

Similar Messages

  • When I open iTunes it is slow to open for one, and two when it does see my iPhone and i go to sync it this is what I get in return... The iPhone "My Name here" could not be synced because the iPhone could not be found on the network. that is a pop up box

    When I open iTunes it is slow to open for one, and two when it does see my iPhone and i go to sync it this is what I get in return... The iPhone "My Name here" could not be synced because the iPhone could not be found on the network. that is a pop up box in middle of screen that says that it does it like every time I go to sync the phone after i do app updates. I am getting very frustrated by this can someone please help. I have made 2 other discussion topics about this and no replies on them. Please if anyone can help I ask for help. This has occurred ever since the iOS 5.1 update and the iTunes 10.6.0 and still continues with the iTunes 10.6.1 update just yesterday and perhaps even worse now. PLEASE HELP IF YOU CAN. I have looked through my network settings etc and everything looks good here on my side.

    When I open iTunes it is slow to open for one, and two when it does see my iPhone and i go to sync it this is what I get in return... The iPhone "My Name here" could not be synced because the iPhone could not be found on the network. that is a pop up box in middle of screen that says that it does it like every time I go to sync the phone after i do app updates. I am getting very frustrated by this can someone please help. I have made 2 other discussion topics about this and no replies on them. Please if anyone can help I ask for help. This has occurred ever since the iOS 5.1 update and the iTunes 10.6.0 and still continues with the iTunes 10.6.1 update just yesterday and perhaps even worse now. PLEASE HELP IF YOU CAN. I have looked through my network settings etc and everything looks good here on my side.

  • Hi, I want to buy Adobe Connect for 25 and maybe more attendees by one host (teacher), but I cant find the price of this set up?

    Hi, I want to buy Adobe Connect for 25 and maybe more attendees by one host (teacher), but I cant find the price of this set up?
    Can anybody help me pls?

    Hm, it seems the new website has obscured the option for purchasing the smaller monthly accounts. You can purchase it here. Adobe Connect | Meetings.
    If you need more than the 25 per meeting limit, you can reach out to a reseller of your choice that covers your area, Adobe Connect | Strategic Partners.

  • Getting new Mac for Aperture and have a question...

    I totally realize that this is a personal preference with no "wrong" way to do it. However, I would appreciate some thoughts so I can form a better idea of how I will set up an Aperture workflow that will work for me for a long time and how to configure my new iMac.
    I use the referenced library workflow and store both my masters and Aperture library on my current internal drive with both backed up to externals. I'm getting a new Mac with the SSD drive for apps and OS (and Aperture library as well). The question is, should I get the mega 2 TB internal HDD along with that SSD for all my masters (which would also include my music and home-made movies)?
    My current photo storage adds up to only 130GB right now and grows slowly. I don't even think I would double that in the next year. I realize that if I had, say, a 1.5 TB size Masters library, the the answer would be obvious that I would need to store externally because the iMac HDD isn't big enough. But that isn't my situation.
    But since I would be able to fit all my photos on an internal HDD (2TB) to use as referenced, is there a better reason to skip the internal 2TB HDD and just get hooked up with some good, high-speed external system and stick with an internal SSD to just handle the OS, music, and apps? In other words, all my media (photos and movies) would always be stored AND edited from an external drive (I will actually edit on the SSD and then move the referenced files to the external). This means that from now on all new Macs I ever get will only need a moderate sized SSD for OS and apps. I would basicallt forever keep all things media on externals.
    I hope this makes sense. Thanks for any help with this.

    jbshanks wrote:
    One other thing... the only way for me to get a 1GB VRAM now is to buy the top-of-the-line iMac. That's the issue.
    I've seen that also. That's why I added the "If you can wait.." statement.
    If you need to purchase before say late October, then the specs you list for the 21" iMac are quite good and the possibility of developers designing GPU threads that require caching in the VRAM may or may not need amounts beyond 512 MB. The fact that Apple offers an upgrade to the 2 GB VRAM video adapter on their high-end machine tells me that they know that the Pro Apps will be able to take advantage of that amount (not that it is necessary for the enthusiast looking to have a good Aperture experience).
    SierraDragon has much more experience than I with Aperture, so he may be able to shed some light on this one.
    For my part, I run a 17" MacBook Pro (late 2011) which has the 2.5 Ghz i7, 8 GB Apple provided RAM, and the AMD 6770 with 1 GB VRAM. I installed an OWC 480 GB SSD and I am connected to the Apple Thunderbolt Display (because this machine only offers a Thunderbolt port to connect video signals with). Aperture runs fine on my machine (although for some reason cropping takes a couple of seconds now, where it was immediate before the AP 3.3 update). I run Photoshop CS6 and Illustrator CS6 without any issues on this machine, so it is definitely capable of running in a professional environment.
    Since your specs call-out a 2.8 Ghz i7, 16+ GB RAM and an SSD, I personally would not hesitate to purchase that machine if you need to purchase soon. I just mentioned the 1 GB VRAM due to your wanting to be able to handle 4+ years of updates to the OS and software. That doesn't mean the 512 GB VRAM won't work great, just that the 1 GB VRAM would be additional insurance (sort of like Apple Care).

  • Quicktime won't open for me and I can't locate it in activity monitor. Haven't used it for a year or so.

    Quicktime won't open for me. It was fine about a year ago. Not coming up in activity monitor. What do I do to fix this?
    Would appreciate any help as I am not particularly computer savvy.
    thanks
    Janine

    Greyed imaged in the Import dialog box mean you have already imported the photos into Lightroom, so there is no need and no benefit to importing them a second time.
    Just go to the Library module, search for the desired photos, and resume working on these photos.

  • My iTunes wont open for me and i've reinstalled it and it still dont work?!

    It started the other day, everytime I click on iTunes, it comes up saying that iTunes has encountered a problem and needs to close. And it askes me if I would like to Send Error Report or not. I have removed iTunes off my computer completely and reinstalled it and it still didnt work. So I removed it again and used a different email to use for it and installed it and it still doesnt work for me now. Can anyone please help me? I have an ipod and i cant add my music without iTunes.....
    please help me

    Hey I know how fusterating it is. I have an ipod nano (2nd gen) and I am having the same problem. It's been over a month now. I've tried to uninstall and reinstall it and it still won't come up. I click on it and it says "itunes has encountered a problem and needs to close." I have sent error reports many times and still nothing. I spent over $200 and the product doesn't work. Let me tell ya, I am very unhappy and dissapointed. Please someone help.

  • Which ports need to be open for messages and facetime to work properly?

    I noticed that Messages no longer works since upgrading to Yosemite on my work network. But it did when i was in Mavericks. Did they change something in Messages in the upgrade that would cause it to no longer work? ports?
    I'm behind my work firewall, which ports need to be open for messages to work properly?

    Just make sure your 9001 port is open.
    Hope this works..
    Hamid

  • For Loop and Void Method Questions

    Question 1: How would I write a for loop that repeats the according to the number entered, to prompt the user to enter a number (double) between 1 and 100. If the number is outside this range it is not accepted.
    Question: 2 Also how would I write a for loop to do sum and find the average of the array numbers in a seperate void method( does not return anything to the main method)?
    Question: 3 (first code snippet) With my for loop that is used to process each number in the array and square it and cube it and display the results to 2 decimal places. How do I make it so say I want the array to allow me to enter 2 numbers (so I enter 2 numbers) then it asks me to enter a number between 1 -100 (which will prompt 2 times) that it shows me the results for the entered numbers between 1-100 after one another instead of number then result number then result like I how it now.
    for (int index = 0; index < howNum; index++) // process each number in the array
              enterYourNumbers = JOptionPane.showInputDialog   
                            ("Enter a number between 1 and 100");                       
              numArray = new double[howNum]; 
            try
                numArray[index] = Double.parseDouble(enterYourNumbers);
            catch (NumberFormatException e)
                    enterYourNumbers = JOptionPane.showInputDialog
                              ("Enter a number between 1 and 100");                          
                DecimalFormat fmt = new DecimalFormat ("###,###.00");
                JOptionPane.showMessageDialog(null, enterYourNumbers + " "  + "squared is "  + fmt.format(calcSquare(numArray[index]))
                                              + "\n" + enterYourNumbers + " " +  "cubed is " + fmt.format(calcCube(numArray[index])));                                                                           
                wantToContinue = JOptionPane.showInputDialog ("Do you want to continue(y/n)? ");
      while (wantToContinue.equalsIgnoreCase("y"));
    import javax.swing.*;
    import java.text.DecimalFormat;
    public class Array
        public static void main(String[] args)
            int howNum = 0;
            int whichNum = 0;     
            double[] numArray;
            boolean invalidInput = true;
            String howManyNumbers, enterYourNumbers, wantToContinue;
      do // repeat program while "y"
          do // repeat if invalid input
            howManyNumbers = JOptionPane.showInputDialog
                        ("How many numbers do you want to enter");                     
            try
                 howNum = Integer.parseInt(howManyNumbers);
                 invalidInput =  false;
            catch (NumberFormatException e )
                howManyNumbers = JOptionPane.showInputDialog
                            ("How many numbers do you want to enter");
          while (invalidInput);
          for (int index = 0; index < howNum; index++) // process each number in the array
              enterYourNumbers = JOptionPane.showInputDialog   
                            ("Enter a number between 1 and 100");                       
              numArray = new double[howNum]; 
            try
                numArray[index] = Double.parseDouble(enterYourNumbers);
            catch (NumberFormatException e)
                    enterYourNumbers = JOptionPane.showInputDialog
                              ("Enter a number between 1 and 100");                          
                DecimalFormat fmt = new DecimalFormat ("###,###.00");
                JOptionPane.showMessageDialog(null, enterYourNumbers + " "  + "squared is "  + fmt.format(calcSquare(numArray[index]))
                                              + "\n" + enterYourNumbers + " " +  "cubed is " + fmt.format(calcCube(numArray[index])));                                                                           
                wantToContinue = JOptionPane.showInputDialog ("Do you want to continue(y/n)? ");
      while (wantToContinue.equalsIgnoreCase("y"));
        public static double calcSquare(double yourNumberSquared)
            return yourNumberSquared * yourNumberSquared;       
        public static double calcCube(double yourNumberCubed)
           return yourNumberCubed * yourNumberCubed * yourNumberCubed;              
        public static void calcAverage(double yourNumberAverage)
    }

    DeafBox wrote:
    Question 1: How would I write a for loop that repeats the according to the number entered, to prompt the user to enter a number (double) between 1 and 100. If the number is outside this range it is not accepted. Use a while loop instead.
    Question: 2 Also how would I write a for loop to do sum and find the average of the array numbers in a seperate void method( does not return anything to the main method)? Why would you want to use 2 methods. Use the loop to sum the numbers. Then after the loop a single line of code calculates the average.
    Question: 3 (first code snippet) With my for loop that is used to process each number in the array and square it and cube it and display the results to 2 decimal places. How do I make it so say I want the array to allow me to enter 2 numbers (so I enter 2 numbers) then it asks me to enter a number between 1 -100 (which will prompt 2 times) that it shows me the results for the entered numbers between 1-100 after one another instead of number then result number then result like I how it now. If I understand you correctly, use 2 loops. One gathers user inputs and stores them in an array/List. The second loop iterates over the array/List and does calculations.

  • Difference in string comparisons between varchar and nvarchar

    These statements were executed on SQL Server 2008 R2 Enterprise.  Collation is the default SQL_Latin1_General_CP1_CI_AS.
    Any ideas why the difference in behavior?
    DECLARE @StringWithCharZero VARCHAR(100), @StringWithoutCharZero VARCHAR(100);
    SELECT @StringWithCharZero = CHAR(0) + 'TEST', @StringWithoutCharZero = 'TEST';
    IF @StringWithCharZero = @StringWithoutCharZero
    BEGIN
    PRINT 'VARCHAR EQUAL';
    select ASCII(LEFT(@StringWithCharZero, 1)), ASCII(LEFT(@StringWithoutCharZero, 1));
    END
    ELSE
    BEGIN
    PRINT 'VARCHAR NOT EQUAL';
    select ASCII(LEFT(@StringWithCharZero, 1)), ASCII(LEFT(@StringWithoutCharZero, 1));
    END;
    GO
    DECLARE @StringWithCharZero NVARCHAR(100), @StringWithoutCharZero NVARCHAR(100);
    SELECT @StringWithCharZero = NCHAR(0) + N'TEST', @StringWithoutCharZero = N'TEST';
    IF @StringWithCharZero = @StringWithoutCharZero
    BEGIN
    PRINT 'NVARCHAR EQUAL';
    select UNICODE(LEFT(@StringWithCharZero, 1)), UNICODE(LEFT(@StringWithoutCharZero, 1));
    END
    ELSE
    BEGIN
    PRINT 'NVARCHAR NOT EQUAL';
    select UNICODE(LEFT(@StringWithCharZero, 1)), UNICODE(LEFT(@StringWithoutCharZero, 1));
    END;
    GO

    Hello,
    I got the followng result after run the query on SQL Server 2008R2 SP2 Enterprise edition:
    SQL Server specific version: Microsoft SQL Server 2008 R2 (SP2) - 10.50.4260.0 (X64)   Jul 11 2012 15:47:13   Copyright (c) Microsoft Corporation  Enterprise Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack
    1) (Hypervisor)
    Please install the latest Service Pack for SQL Server 2008R2, we can get it from the link below:
    How to obtain the latest service pack for SQL Server 2008 R2:
    http://support.microsoft.com/kb/2527041
    Regards,
    Elvis Long
    TechNet Community Support

  • Validation Script for Dates and General Event Questions

    I have just started using Javascript, and am now using some objects and methods etc. that I did not even know about. It's progressing rather well, now I need to know some Livecycle Designer Basics that I can't seem to answer from my searches.
    Here's what I am trying to do in English:
    I want users to choose a date that they will miss at our Farmers Market. I have the date field on the form - works well.
    I want to validate the entry for:
    The date must be today or in the future
    AND
    The date must be before the closing date
    AND
    The date must be a Saturday
    Here's some script I've written and placed in the Validation Event (I have actually written more for testing out that the results are coming out properly):
    ----- form1.#subform[0].Missdate::validate - (JavaScript, client) ----------------------------------
    var entereddate = this.rawValue;// The date vendor will not attend as entered on the form
    var dentry = new Date(entereddate.slice(0,4),[entereddate.slice(5,7)-1],entereddate.slice(8,10),0,0,0); // month starts at 0!
    var closingdate = "October 04,2008" // closing date of the market
    var today = Date();// today
    (dentry.getDay() = 6);// and attempt to validate that the day = Saturday - nothing happens!
    But now -
    How do I actually validate this - my last statement seems to be ignored. How to I force a 'false' being returned? In Formcalc I simply put a camparison statement here and if it resulted in 'False' validation failed and if it resulted in 'True' it passed - What's the JS equivalent? Or are the variables giving me troubles?
    Maybe I'm putting this in the wrong Event? If so which one should I place it in.
    I want to force the user to enter the correct data - how do I code this - and put in a custom message refering to this. I may even get fancy and ask the user if the next Saturday is what they meant if they enter the incorrect one (this will be a real challenge!)
    I think I'm lacking some basic knowledge here that other posts have assumed. Please refer me to any help pages as well - although I've done extensive searching on this and have not really found a good explanation of Validation - only specific pages that are not basic or general enough for my understanding. Thank!

    In the validation script you have to allow the field's length to be 0, or
    it will not be possible to clear it...

  • Lists of 69 cent songs won't open in iTunes, but other offers will open for preview and purchase.

    I've been trying to link from email to see the songs offered for 69 cents.  The store opens, but when I click on the tabs for #1 Hits or the various genres, I can't view which songs are offered, let only make a purchase.  Other links from email work normally.

    I wasn't able to access the 69cent songs on my iPad through the email, but I just connected to iTunes through my computer and am able to access them from there.  Not the ideal fix, but it works.
    Note-I had previously posted in another discussion on this topic but could not find it to post this work-around.

  • Where is the getString() implementation for RS and Object class question

    Dear all,
    I had these two questions ringing since a long time.
    1)ResultSet is an interface.
    In my jdbc code I have generally written rs.getString() and rs.getInt etc.. without giving a second thought as to where exactly is this getter implemented !
    I have RTF API .. without too much help.
    Could some one kindly explain Where is the implementation of the getString method ?
    2) Could you please tell why the Wait() Notify() and NotifyAll methods have been implemented in the Object class ? What was the need to define em in the Object class ?
    Thanks in advance for your time spent on this.
    Rgds

    Sarvananda wrote:
    In the MySQL driver for example it's implemented in com.mysql.jdbc.ResultSet Right. Now it makes sense to me. Every single db that gives me a driver will have their specific implementation for the interface methods of ResultSet.
    >
    why do you need that?
    ..Thats a design decision
    One of my friends asked me this and I was caught unawares. Any ideas on what factors could have made this design decision ?
    Rgds
    >
    In the MySQL driver for example it's implemented in com.mysql.jdbc.ResultSet Right. Now it makes sense to me. Every single db that gives me a driver will have their specific implementation for the interface methods of ResultSet.
    >
    why do you need that?
    ..Thats a design decision
    One of my friends asked me this and I was caught unawares. Any ideas on what factors could have made this design decision ?
    A desire to not have to couple your code to a particular database and JDBC driver. It's a classic example of the abstract factory pattern

  • 2.0Ghz Core Duo MBP: Is it Leapord Ready? And one more question too.

    Well, just as I said in the subject, I've got a year old MBP, and was really curious as to whether it can weather (pun intended?) Leopard. And what about 64-bit applications?
    My other question is that I was once told that inorder to get the full functionality of the Core Duo processor, you had to have matching sticks of RAM installed, ie 2x512mb or 2x1GB. Is this true? I'm thinking that it's probably worth spending the $50 to just get another 1GB stick, but I just can't seem to find the answer to this question.
    Thanks!

    Your MBP will run Mac OS X 10.5 Leopard just fine.
    As for 64-bit applications, you will find that most application developers will release them as a single version so it will automatically use the rght binaries for your MBP. There will be the odd application that will be 64-bit only however those will be very specialised and not for general use.
    For maximum performance the SODIMMs should be matched however the difference you will actually get will be minimal. Realistically you should have 2GB (2 x 1GB) installed anyway to get the most out of your MBP.

  • Darwinports installation help and one more question

    (other Q is at the bottom)
    the installation worked, but my problem is that the documentation on the Darwinports website tells you how to install from source. So I proceeded to the next section where it describes how to search and install software ports. My problem is, I'm sure I have to do more to Darwinports because there are commands they talk about using, like 'port', which don't exist yet.
    My two guesses:
    I have more to configure or
    I have to configure $PATH (but I dont know what I should add to the $PATH string because they dont mention what to do if you're installing via binaries on the website)
    I decided to just try to run ./configure for a program which is able to run off Darwinports. The configure told me my CURL was too old so I downloaded a newer version, which gave me this error:
    C++ preprocessor "/lib/cpp" fails sanity check
    I'm baffled. I have NO idea what's going on and could not find a solution when searching that error.
    FYI: I have the developer tools installed (xcode, gcc etc)

    Haven't compiled anything until this attempt.
    XCode is installed
    I can't remember what version of Panther I initially installed but I do know it was definitely Panther and it was installed over a year ago.
    Here is the error. I did a search for 'lib/cpp' in the text and there were several results, all of which are contained in this pasted text (hence I'm not sure if anything important is cut off but if so I can always upload the log to my ISP's webspace if someone would be REALLY kind and look at it)
    | Syntax error
    configure:6758: result: /lib/cpp
    configure:6782: /lib/cpp conftest.cc
    ./configure: line 1: /lib/cpp: No such file or directory
    configure:6788: $? = 127
    configure: failed program was:
    | /* confdefs.h. */
    |
    | #define PACKAGE_NAME "curl"
    | #define PACKAGE_TARNAME "curl"
    | #define PACKAGE_VERSION "-"
    | #define PACKAGE_STRING "curl -"
    | #define PACKAGE_BUGREPORT "a suitable curl mailing list => http://curl.haxx.se/mail/"
    | #define PACKAGE "curl"
    | #define VERSION "7.15.0"
    | #define OS "powerpc-apple-darwin7.9.0"
    | #ifdef __cplusplus
    | void exit (int);
    | #endif
    | /* end confdefs.h. */
    | #ifdef _STDC_
    | # include <limits.h>
    | #else
    | # include <assert.h>
    | #endif
    | Syntax error
    configure:6782: /lib/cpp conftest.cc
    ./configure: line 1: /lib/cpp: No such file or directory
    configure:6788: $? = 127
    configure: failed program was:
    | /* confdefs.h. */

  • In iPhone 4 the camera shutter doesn't open for a minute or more

    Have an iPhone for over 3 years and this is new. Cold start doesn't correct
    Franklin

    hey sorry to hear that
    but my problem is solved now they replaced me a new one ,it was a hardware problem though, they were really friendly with me
    best wishes for ur iphone
    peace

Maybe you are looking for

  • Is your Zen Touch froz

    Does it hang at the "Zen Touch" screen? Is it not accesible whatsoever?Okay here's the thing. A lot of people are having this problem, even I had it. So this is what you need to do: First off, try running a cleanup of your Zen. To run the cleanup you

  • Getting Error in NVRAM

    Hi, I'm Getting Error in router from NVRAMwhile accessing below command in privilge 4 login CTS-SEC-CBE#sh configuration Using 14350 out of 262144 bytes %Error opening nvram:/startup-config (Permission denied) The error not observed while executing t

  • Templates Folder?

    I downloaded a template for a check register. Now where do I put it? I knew where everything went in 9, but X leaves me scratching my head. Thanks.

  • Hi guru's what is the difference between table and temlate in smartforms

    hi guru's what is the difference between table and temlate in smartforms

  • How do I get my numark idj live to be recognized on my iPad with iOS 6.0.1

    I just got the Numark iDJ live for use with my iOad 2 running iOS 6.0.1 without knowing that idj live wouldn't be recognized with the new iOS. When will this be corrected?