Why do i have to init a VARCHAR for a SELECT in a Pro*C PL/SQL block?

Hi,
i use PL/SQL Block in a Embedded C Programm and compile with the PRO*C Compiler. Oracle 10gR2.
When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.
Same problem with assignments to VARCHAR variables.
Question: why do i need to initialize the variable?
Tnx for your help!
The following test program shows my issue:
#include <stdio.h>
#include <string.h>
#include "oraca.h"
#include "sqlca.h"
#define USER "scott"
#define PASSWORD "tiger"
int main()
EXEC SQL BEGIN DECLARE SECTION;
char *db_user   = USER;
char *db_passw  = PASSWORD;
VARCHAR sysdate_str[64];
EXEC SQL END DECLARE SECTION;
EXEC SQL CONNECT :db_user identified by :db_passw;
/* this works */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL SELECT
to_char( sysdate, 'dd.mm.yy hh24:mi:ss' )
into :sysdate_str
from DUAL
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
/* following code does not work, sqlcode = - 1458 */
/* 01458, 00000, "invalid length inside variable character string" */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL EXECUTE
BEGIN
select to_char( SYSDATE, 'dd.mm.yy hh24:mi:ss')
into :sysdate_str
from dual;
END;
END-EXEC;
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
/* following code does not work, sqlcode = - 1458 */
/* 01458, 00000, "invalid length inside variable character string" */
sysdate_str.len = 1000; /* invalid length */
EXEC SQL EXECUTE
BEGIN
:sysdate_str := to_char( SYSDATE, 'dd.mm.yy hh24:mi:ss');
END;
END-EXEC;
printf ("sqlca.sqlcode %d\n", sqlca.sqlcode);
return(0);
Edited by: jjaeckel on May 5, 2010 8:37 PM

jjaeckel wrote:
When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.A bind variable in a SQL is simply a place holder. The SQL engine has no idea what data type the value for that placeholder will be. When itself needs to return a value via that placeholder to the caller, it needs to know what the limits/size of the caller's variable is that will be receiving the value from it.
The way that the SQL engine knows what the data type and size are of a placeholder/bindvar, is by you the caller, telling it.. by binding the variable you will be using, to this placeholder.
This bind process "exposes" the data type and size of the variable that will be used for binding (sending/receiving data).

Similar Messages

  • Why do i have to wait 24 hrs. for serial number on acrobat pro

    why do i have to wait 24 hrs. for serial number for acrobat pro

    jjaeckel wrote:
    When i Select .. Into a VARCHAR bind variable, i have to initialize the variable before, otherwise i get an ORA-1458.A bind variable in a SQL is simply a place holder. The SQL engine has no idea what data type the value for that placeholder will be. When itself needs to return a value via that placeholder to the caller, it needs to know what the limits/size of the caller's variable is that will be receiving the value from it.
    The way that the SQL engine knows what the data type and size are of a placeholder/bindvar, is by you the caller, telling it.. by binding the variable you will be using, to this placeholder.
    This bind process "exposes" the data type and size of the variable that will be used for binding (sending/receiving data).

  • HT201250 Why do i have to use the password for time capsule every time i start my computer

    Why do I have to use thr password for time capsuel every time I start my imac?

    With hindsight, the previous response I got from Apple was just a way of shelving the problem.
    Having just had to reset my password after another 3 months, I contacted Apple again, and it happened that the senior advisor whom the phone agent consulted had had exactly the same problem as me, and had found that iTunes could fix it.  However when I spoke to iTunes they told me I needed to speak to Apple ID account security.  The Apple ID account security representative spoke to a senior adviser, then told me that it would be fixed after I reset my password.  However I am not convinced that anything was actually done, so I may be back here in another 3 months ...
    To modify Roger's advice, the solution I was given is: go to https://expresslane.apple.com ; select 'All Products and Services' in the first column, 'iTunes' in the second column, 'iTunes Store' in the third column, then "Account Management" and "Apple ID account security", then "Talk to Apple support now". A complication is that the "Talk to Apple support now" option only appears when UK English is selected.  So you either need to select UK at the top, or find another way of making phone contact (the email link just went back to the person in iTunes)!

  • HT204053 If I purchased Sling Player app for my IPAd, why do I have to buy it again for my Iphone?

    If I purchased Sling Player App for my Ipad, why do I have to purchase it again for my new Iphone?

    1. Yes.
    2. No.
    3. Log into the Mac App Store with the Apple ID you used to purchase it and download it again, or if you still have the installer application, move it to the iMac.
    (68980)

  • How long have the life cycles been for previous 13" MacBook / MacBook Pros?

    How long have the life cycles been for previous 13" MacBook / MacBook Pros before Apple introduced the next model?

    Check out this site for information like that:
    http://buyersguide.macrumors.com/

  • Why do I have to use security code for wifi router each time I turn on iPad 3?

    Why do I have to enter wifi security code for my router each time I turn on ipad3?  I have checked all the settings I could but is this a router problem?

    If you're hiding your network SSID and/or using WEP security, I think these can cause this problem.  If you're hiding your SSID, there's really no point in doing that since there are ways people can easily see it if they're looking to do harm anyway.  If you're using WEP security, consider changing to WPA2 which is much more secure than WEP.

  • Why do i have to keep reinstalling Itunes for my Iphone 3gs and Ipad 1 to be detected

    I have to keep reinstalling Itunes for it to recognize my I products,every few days i go to connect my iphone 3gs or my ipad 1 to my pc which is running windows 7 64 bit and they are not detected, so i uninstall itunes,the reinstall itunes and then my I products are then detected... i can then do things.
    But a few days later  the same thing happens,i have had to do this about 8 times so far.. why is this happening and how can i get in tunes to detect my iphone and ipad  without reinstalling itunes..thanks

    Please ignore this post, being that I just discovered the fix action for this problem, which involved installing the software download" iPhone SDK update. Thank God!

  • TS1702 why do i have to put in password for free apps

    why do i have to put a password in for free apps

    That's how it is.  But really, do you want anyone who happens to get his hands on your iPad to download whatever? It's your account, and entering a password insures you are in control.

  • Why do I have the SMART monitoring icon on on my mac book pro?

    Why do I have the SMART monitoring icon on constantly in my toolbar? Can I get it off or is there a problem

    What did you install to get it there?
    With the app closed, drag it to the trash or right clcok on it and select Options>Remove fro dock
    Also go to System Preferences.Users and Groups>your user>Login Items and delete it as a log in item if it is listed.

  • HT202879 I would like to have a spreadsheet editing software for my new Template Numbers Pro but my operating system is 10.7.  Are there other editing software programs (less the 10.9) that can work with this app?

    Hi,
    I am looking for some editing software for my new Template Numbers Pro.  Numbers is 10.9, my computer is only 10.7.  What do you suggest?
    Thanks,
    Billieoh

    Billieoh wrote:
    That is good to know.  Frankly I don't know what kind of machine I have.  I have a Mac OSX Lion 10.7.3 early 2008.
    If it's the "Templates for Numbers Pro" on the Mac App Store then you need OSX 10.7 or later.  You'll need iWork '09 or later.
    It looks as if you want to use the iOS version of the same templates then you will need the latest Numbers there.  And if you use the latest Numbers there and want to sync to the Mac, you'll need to have Mavericks and Numbers 3.
    SG

  • Why do I have to wait two hours to see selected movie?, why do I have to wait two hours to see selected movie?

    I am new to Apple TV and not a sophisticated user of all this new technology. But we decided to plunge in an get the Apple TV box,  join NetFlix and all the rest.  So far it is a cruel joke on two old people.  I selected a movie last night and we had to wait two hours before it "loaded" so we could watch it.  Then in stopped cold a couple times.
    We searched around couple nights ago and found reecent movies renting for $19.95 and $11.95.  What a farce! Why did we buy the $100 box and pay the Netflix and Hule dues to  struggle with various devices we don't quite undetstand and then pay more to watch less!
    What are we missing here?  I'm willing to be educated!  Ha Ha Ha.

    had to wait two hours before it "loaded" so we could watch it.
    Did you rent it or buy it?  There used to be a requirment that when you rented a movie it had to completley download first.  I did not think that was still the case but have not rented anything in a long time.  Movie and TV purches are usually avialalbe to start being watched in about 10 - 90 sec. from when you click buy.
    Then in stopped cold a couple times.
    That plus the extermely slow start times are a strong indicator that your local network or internet acess have a problem and can not support streaming video.  If you are using WiFi for ATV I would start by trying a wired connection.
    reecent movies renting for $19.95 and $11.95. 
    Those are the purchase prices not the rental prices.  Movie rentals are $5.99 - $2.99

  • Why do I have to change the password for my Apple ID every 3 months?

    Until recently I assummed that everyone had to change their password every 3 months, but on searching the web I found only a couple of mentions of other people who have to do this.
    My Apple ID was originally set up when I bought a Mac through my company (which was not a developer) from AppleStore Small & Medium Businesses in 2002.  Perhaps all accounts set up that way in 2002 work like this?
    The only solutions I can think of are:
    a) Change something in my Password and Security settings, but I can't see anything relevant.
    b) Move to a new Apple ID, but I think I would lose access to existing apps I have purchased?
    c) Ask Apple to change my settings, but the response a developer with this problem got from Apple was: "I am unable to change the password requirements and restrictions for your Developer Account".
    Anyone else have to keep changing their password?

    With hindsight, the previous response I got from Apple was just a way of shelving the problem.
    Having just had to reset my password after another 3 months, I contacted Apple again, and it happened that the senior advisor whom the phone agent consulted had had exactly the same problem as me, and had found that iTunes could fix it.  However when I spoke to iTunes they told me I needed to speak to Apple ID account security.  The Apple ID account security representative spoke to a senior adviser, then told me that it would be fixed after I reset my password.  However I am not convinced that anything was actually done, so I may be back here in another 3 months ...
    To modify Roger's advice, the solution I was given is: go to https://expresslane.apple.com ; select 'All Products and Services' in the first column, 'iTunes' in the second column, 'iTunes Store' in the third column, then "Account Management" and "Apple ID account security", then "Talk to Apple support now". A complication is that the "Talk to Apple support now" option only appears when UK English is selected.  So you either need to select UK at the top, or find another way of making phone contact (the email link just went back to the person in iTunes)!

  • Why do I have to pay to create a PDF in Acrobat X Pro when I have owned it for quite awhile?

    I have been needing to create a portfolio with my designs and I need numerous files to make one PDF. I know how to do it, but apparently, I have to pay now. I NEVER had to pay a few years ago, and when I actually need this, I have to fork out money when I have already spent it on the software. Is there a solution to for this, or do I have submit and pay for my existing software?

    But, if you are still getting the message that you need to pay then
    1. Check the app you are running. It probably isn't Acrobat. Could be Adobe Reader.
    2. If it's Acrobat please let us see a screen shot (DON'T email it!)

  • Why do i have to download a program for my IPod Nano?

    I purchased a IPod nano today and was very disappointed to find out I cannot just plug in the cord to the usb and drag and drop my music from any of my computers. I have to go online and download a file that take 3 hours and put it on every computer that I want to transfer music from. This doesn't sound right. I waited 40 minutes for tech support on the phone and no one ever came to the line. This is terrible. Does anyone have any suggestions?
    xp Windows XP

    It is hard to download iTunes if you only have a dialup internet connection. Do you know anyone with a broadband connection that would be willing to download this program for you?
    I helped my daughter's friend do this--she gave up trying to download iTunes after 90 minutes.
    If your friend can download the program from the Apple Website (not inside itunes), a CD can be burned containing the installation files.
    Have your friend save the installation file to the computer desktop and then burn a data CD for you.

  • Why do you have to use security questions for purchasing stuff from itunes

    please make all apple products not use security questions to purchase  stuff in the itunes store

    If you mean that you've forgotten the answers to your security questions, then if youhave a rescue email address (which is not the same thing as an alternate email address) set up on your account then you can go to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you should see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address (you won't be able to add one until you can answer 2 of your questions) then see if this user tip helps : https://discussions.apple.com/docs/DOC-4551
    e.g. you can try contacting iTunes Support : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management , and then try Apple ID Account Security
    or try ringing Apple in your country and ask to talk to the Accounts Security Team : http://support.apple.com/kb/HE57

Maybe you are looking for