Sponsored Content
Top Forums Programming Oracle Database: INSERT INTO with TO_DATE function Post 302464426 by Poonamol on Wednesday 20th of October 2010 06:46:12 AM
Old 10-20-2010
Oracle Database: INSERT INTO with TO_DATE function

Hello,

I am writting a procedure in shell script as,
Code:
set serveroutput on
declare
date_gen DATE := $DATEGEN;
begin
INSERT INTO TBL1 ( EMPNAME,EMPID,EMPBDATE)
VALUES($EMPNAME,$EMPID,TO_DATE(date_gen,'YYYY-MM-DD'));
end;
/

Where DATEGEN is unix string variable which I need to use into INSERT INTO statement.
I am receiving error message as,
Code:
SQL> SQL> SQL> SQL>   2    3    4    5    6    7    8    9   10   11  date_gen DATE := 20100913;
                 *
ERROR at line 3:
ORA-06550: line 3, column 18:
PLS-00382: expression is of wrong type
ORA-06550: line 3, column 10:
PL/SQL: Item ignored
ORA-06550: line 7, column 15:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 7, column 1:
PL/SQL: Statement ignored

How can I assign string variable to date_gen DATE; in procedure?
How can I use this date into INSERT statement?
Could you please help me out in inserting data into table with TO_DATE function.
Please help me out...
Thanks in advance.
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Insert value of vmstat to database.

Hi guys , I m trying to store the output of vmstat 1 10 into a database. I have done the necessary homework to connect bash to interact with the database. Program logic. 1)storing the output of vmstat 1 10 to a file named abc.txt 2)I m applying a filter to vmstat to get desired output... (4 Replies)
Discussion started by: pinga123
4 Replies

2. Shell Programming and Scripting

Korn shell program to parse CSV text file and insert values into Oracle database

Enclosed is comma separated text file. I need to write a korn shell program that will parse the text file and insert the values into Oracle database. I need to write the korn shell program on Red Hat Enterprise Linux server. Oracle database is 10g. (15 Replies)
Discussion started by: shellguy
15 Replies

3. Solaris

Can't create database after Oracle Database installation

I installed Oracle 10 software on Solaris 11 Express, everything was fine execpt I can't create database using dbca.rsp file. I populated file with following options. OPERATION_TYPE = "createDatabase" GDBNAME = "solaris_user.domain.com" SID = "solaris_user" TEMPLATENAME = "General... (0 Replies)
Discussion started by: solaris_user
0 Replies

4. Shell Programming and Scripting

Pass a variable string in To_Date Oracle function in shell script

Hello, I am trying to execute an SQL query from shell script. A part of script is something like this: fromDate=`echo $(date +"%F%T") | sed "s/-//g" | sed "s/://g"` $ORACLE_HOME/sqlplus -s /nolog <<EOD1 connect $COSDBUID/$COSDBPWD@$COSDBSID spool... (4 Replies)
Discussion started by: sanketpatel.86
4 Replies

5. Programming

Need help on Insert data to mySQL database

Hi guys, I would like to seek help on inserting data whenever the switch is on or off to my sensor mySQL database in phpMyAdmin from my control.php. I'm using Raspberry PI as my hardware and follow a few tutorials to create my own Web Control Interface, it works perfectly without insert method.... (1 Reply)
Discussion started by: aoiregion
1 Replies

6. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies
OCI_SERVER_VERSION(3)													     OCI_SERVER_VERSION(3)

oci_server_version - Returns the Oracle Database version

SYNOPSIS
string oci_server_version (resource $connection) DESCRIPTION
Returns a string with the Oracle Database version and available options PARAMETERS
o $connection - RETURN VALUES
Returns the version information as a string or FALSE on error. EXAMPLES
Example #1 oci_server_version(3) example <?php $conn = oci_connect("hr", "hrpwd", "localhost/XE"); echo "Server Version: " . oci_server_version($conn); // Displays: // Server Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production // With the Partitioning, OLAP, Data Mining and Real Application Testing option oci_close($conn); ?> NOTES
Note In PHP versions before 5.0.0 you must use ociserverversion(3) instead. This old name still can be used. However it is deprecated and not recommended. SEE ALSO
oci_client_version(3). PHP Documentation Group OCI_SERVER_VERSION(3)
All times are GMT -4. The time now is 09:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy