473,396 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

help with "execute immediate" in oracle

13
hi
i need to insert values in a temporary teble which i dynamically create the columns like tbl_01, tbl_02....
for eg.,
execute immediate 'INSERT INTO TBL_MONTH_LEAVE_DETAIL(TBL_ADM_NO,TBL_MONTH,'TBL_' ||TO_CHAR(SYSDATE,'DD'))'
||'VALUES (TRSTBD_ADM_NO,TO_CHAR(SYSDATE,'MMYY'),1)';

HERE THE COLUMNS ARE TBL_ADM_NO,TBL_MONTH,TBL_01,.....TBL_30
ACCORDING TO THE DAY THE COLUMN WILL BE SELECTED AND A VALUE 1 WILL BE INSERTED.
Nov 27 '08 #1
8 6355
amitpatel66
2,367 Expert 2GB
So what is the error that your dynamic insert statement is displaying?
Nov 27 '08 #2
amitpatel66
2,367 Expert 2GB
Try this statement:

Expand|Select|Wrap|Line Numbers
  1.  
  2. execute immediate 'INSERT INTO TBL_MONTH_LEAVE_DETAIL(TBL_ADM_NO,TBL_MONTH,TBL_'||TO_CHAR(SYSDATE,'DD'))||'VALUES (TRSTBD_ADM_NO,TO_CHAR(SYSDATE,''MMYY''),1)';
  3.  
  4.  
Nov 27 '08 #3
cmuraz
13
the error says column not allowed here
Nov 28 '08 #4
cmuraz
13
can we concatenate the column names in the execute immedite statement?
Nov 28 '08 #5
Pilgrim333
127 100+
Hi,

Check you parenthesis and quotes, i think you are making a mistake with that.

Pilgrim.
Nov 28 '08 #6
debasisdas
8,127 Expert 4TB
@cmuraz
why you need to concatenate the column names in insert statement ?
Nov 28 '08 #7
cmuraz
13
thank u guys n sorry for the trouble..
ive done a mistake in the paranthesis and quotation mark.
i ve misplaced them in a wrong place...
i got it working now..
thanks a lot
Dec 1 '08 #8
Pilgrim333
127 100+
@cmuraz
Hi,

Good to see that your problem is solved.

Pilgrim.
Dec 1 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: RC | last post by:
In my Access 2002 form, I have a combo box and on the AfterUpdate event I use DoCmd.RunSQL ("UPDATE .... to update records in a table. When it starts to run I get a message "You are about to...
2
by: Eli | last post by:
Hi all We currently have a strange problem with calling a Stored Procedure (SQL Database) in our C# Project. The only error I get is "System error" which says a lot :) Background: We have...
6
by: TJS | last post by:
in vbscript there was a command called "execute" which would process a dynamic string, vb.net dropped that feature ... does anybody have a working solution for sale or free that will execute a...
4
by: David A. Beck | last post by:
I was looking for the "Immediate" window like in Classic VB but could not find it.
0
by: Brew | last post by:
Hello, I'm writing an ASP.NET 2005 (VB) Website with an Oracle 9i backend I have an oracle package with stored procedures and functions I need to use from the VB Code, I'm trying to use the...
23
by: ticfranca | last post by:
Hi, I'm getting this error in the code below: sub Pega_recorde { $database = 'bundinha'; $host = 'localhost'; $usuario = 'myhumoradm'; $senha = 'my8xr2d2'; ...
5
by: stmfc | last post by:
i dont know why pl/sql block below returns no data found error. do you have any idea about it? declare c1 varchar2(80); c2 varchar2(80); begin execute immediate 'select col2 from table1 where...
3
by: rajkumarbathula | last post by:
Hi I was struck up with big problem of executing a oracle stored procedure in C#. Inputs 1:I am having 1 oracle stored procedure eg. myProc() and this procedure takes 1 INOUT parameter. of type...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.