Insert rows into a table in particular order
When i fired a query as
insert into table1 select * from table2 order by req_id .
It is not inserting into table1 as ordered by req_id.Please suggest
ORDER is irrelevant when it comes to storage of data unless its Index organized table. In a Heap Organized table the order in which data is stored is irrelevant.
Here is a small example to show the difference between IOT and HOT.
SQL> create table hot (no integer)
2 /
Table created.
SQL> create table iot (no integer primary key) organization index
2 /
Table created.
SQL> insert into hot select level from dual connect by level <= 10 order by dbms_random.value
2 /
10 rows created.
SQL> select * from hot
2 /
NO
7
6
4
5
10
3
1
9
8
2
10 rows selected.
SQL> insert into iot select level from dual connect by level <= 10 order by dbms_random.value
2 /
10 rows created.
SQL> select * from iot
2 /
NO
1
2
3
4
5
6
7
8
9
10
10 rows selected.Thanks,
Karthick.
Edited by: Karthick_Arp on Feb 5, 2009 3:45 AM
Similar Messages
-
Need to insert rows into 100 tables at a time
hi there,
below is our script for creation of 100 tables...
we need a plsql script, to insert rows into 100 tables at a single time...
please help us...vey urgent...
DECLARE
counter NUMBER;
sql_string VARCHAR2(2000);
BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_table'||counter||'
(id integer primary key, col_a VARCHAR2(42),col_b date,col_c number,col_d varchar2(20),col_e varchar2(20),
col_f varchar2(20),col_g varchar2(20),col_h date,col_i varchar2(20),col_j varchar2(20),col_k date)';
EXECUTE IMMEDIATE sql_string;
END LOOP;
END;
/hi,
below is our procedure and the error we are getting...
Name Null? Type
ID VARCHAR2(10)
COL_A VARCHAR2(10)
COL_B VARCHAR2(10)
COL_C VARCHAR2(10)
COL_D VARCHAR2(10)
COL_E VARCHAR2(10)
COL_F VARCHAR2(10)
COL_G VARCHAR2(10)
COL_H VARCHAR2(10)
COL_J DATE
DECLARE
counter NUMBER;
sql_string VARCHAR2(4000);
BEGIN FOR counter IN 1..100 LOOP sql_string := 'CREATE TABLE emp_a'||counter||'
(id varchar2(10), col_a varchar2(10), col_b varchar2(10), col_c varchar2(10), col_d varchar2(10), col_e varchar2(10),
col_f varchar2(10), col_g varchar2(10), col_h varchar2(10), col_j date)';
EXECUTE IMMEDIATE sql_string;
END LOOP;
END;
DECLARE
counter NUMBER;
sql_string VARCHAR2 (2000);
BEGIN
FOR OuterCounter IN 1 .. 100 LOOP --- table prefix in which it is to be inserted
FOR InnerCounter IN 1 .. 100 LOOP --- records to be inserted
sql_string := 'INSERT INTO emp_a' || Outercounter || ' (id, col_a, col_b, col_c, col_d, col_e, col_f, col_g, col_h, col_j)
VALUES ('
|| InnerCounter || ', to_char( ''col_a''' || innercounter || '),'
|| InnerCounter || ', to_char( ''col_d''' || innercounter || '),'
|| ', to_char( ''col_e''' || innercounter || '),'
|| ', to_char( ''col_f''' || innercounter || '),'
|| ', to_char( ''col_g''' || innercounter || '),'
|| ', to_char( ''col_h''' || innercounter || '),'
|| ', to_char( ''col_j''' || innercounter || '), SYSDATE)';
EXECUTE IMMEDIATE sql_string;
END LOOP;
END LOOP;
END;
DECLARE
ERROR at line 1:
ORA-00907: missing right parenthesis
ORA-06512: at line 17
please check the procedure and write the correct one... -
Help in inserting rows into a table
I have a table called acct_fact,
I need to insert rows in the table using a script but the problem is there's a column called seq_nbr which has random seq nbr of 14character length like 'ZWX98MGD9MVAD6J','ZWX98MG67RVAD6J' etc.,
While inserting rows I need to generate such seq_nbr for those columns and insert rows into the table, can I use any such mechanism in my insert query to insert such random nbr's while inserting rows into a table.
If so please suggest meHi Peter,
Thankyou for the quick reply:)
can you suggest me how to implement it here in my script snippet:
while read var_acct_nbr
do
echo "update acct_attr set acct_attr_exp_dt ='$ExpDate' where Acct_Attr_Value_Text='15' and acct_attr_exp_dt is null and person_id='LDCarrBillAgrm' and acct_nbr='$var_acct_nbr' ;" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
echo "insert into acct_fact values ('$var_acct_nbr','$ExpDate','$ExpTime','*seq_nbr*','N','ProjTereza','Remoção de acordo d; data de expiração: $ExpDate',null,'1','LDE',null);" >> ./$DirectoryName/SQLQuery_$TimeStamp.sql
done < ./$DirectoryName/ExpireAccts_$TimeStamp.LOG
the script takes each acct_nbr nbr form a input file and fires an insert statement.
The one in bold is the column where such sequence need to be inserted.can you help me in implementing the way you suggested in my script i.e., insert statement
Thanks in Advance:)
Edited by: rkrish on Jun 27, 2012 3:04 AM -
Hi,
I want to insert values into a table 'Reasons'.
The table 'Reason' has 5 columns
out of 5 two columns has static data say
column A value 'A'
column E value sysdate
But in the other three columns the vlues are repeating and as follows.
Column B all rows of column x from table B
Column C all rows of column y from table C
Column D list of values as (ONE,TWO,THREE,FOUR)
Please Help
Thanks
Rohit Tanejacreate table tableb(id number,x varchar2(20));
insert into tableb values(1,'APPLE');
insert into tableb values(2,'BANANA');
insert into tableb values(3,'MANGO');
create table tablec(id number,y varchar2(20));
insert into tablec values(1,'ROHIT1');
insert into tablec values(2,'ROHIT2');
insert into tablec values(3,'ROHIT3');
insert into tablec values(4,'ROHIT4');
select 'A' AS COL_A, d.X AS COL_B,d.Y AS COL_C,
to_char(to_date(ROW_NUMBER() OVER(PARTITION BY X,y ORDER BY X,Y),'YYYY'),'YYYYSP') AS COL_D,SYSDATE
FROM ( select a.id , a.x X, b.y Y from tableb a,tablec b , tablec e order by a.x) d
ORDER BY d.X,d.Y
C COL_B COL_C COL_D SYSDATE
A APPLE ROHIT1 ONE 30-SEP-02
A APPLE ROHIT1 TWO 30-SEP-02
A APPLE ROHIT1 THREE 30-SEP-02
A APPLE ROHIT1 FOUR 30-SEP-02
A APPLE ROHIT2 ONE 30-SEP-02
A APPLE ROHIT2 TWO 30-SEP-02
A APPLE ROHIT2 THREE 30-SEP-02
A APPLE ROHIT2 FOUR 30-SEP-02
A APPLE ROHIT3 ONE 30-SEP-02
A APPLE ROHIT3 TWO 30-SEP-02
A APPLE ROHIT3 THREE 30-SEP-02
A APPLE ROHIT3 FOUR 30-SEP-02
A APPLE ROHIT4 ONE 30-SEP-02
A APPLE ROHIT4 TWO 30-SEP-02
A APPLE ROHIT4 THREE 30-SEP-02
A APPLE ROHIT4 FOUR 30-SEP-02
A BANANA ROHIT1 ONE 30-SEP-02
A BANANA ROHIT1 TWO 30-SEP-02
A BANANA ROHIT1 THREE 30-SEP-02
A BANANA ROHIT1 FOUR 30-SEP-02
A BANANA ROHIT2 ONE 30-SEP-02
A BANANA ROHIT2 TWO 30-SEP-02
A BANANA ROHIT2 THREE 30-SEP-02
A BANANA ROHIT2 FOUR 30-SEP-02
A BANANA ROHIT3 ONE 30-SEP-02
A BANANA ROHIT3 TWO 30-SEP-02
A BANANA ROHIT3 THREE 30-SEP-02
A BANANA ROHIT3 FOUR 30-SEP-02
A BANANA ROHIT4 ONE 30-SEP-02
A BANANA ROHIT4 TWO 30-SEP-02
A BANANA ROHIT4 THREE 30-SEP-02
A BANANA ROHIT4 FOUR 30-SEP-02
A MANGO ROHIT1 ONE 30-SEP-02
A MANGO ROHIT1 TWO 30-SEP-02
A MANGO ROHIT1 THREE 30-SEP-02
A MANGO ROHIT1 FOUR 30-SEP-02
A MANGO ROHIT2 ONE 30-SEP-02
A MANGO ROHIT2 TWO 30-SEP-02
A MANGO ROHIT2 THREE 30-SEP-02
A MANGO ROHIT2 FOUR 30-SEP-02
A MANGO ROHIT3 ONE 30-SEP-02
A MANGO ROHIT3 TWO 30-SEP-02
A MANGO ROHIT3 THREE 30-SEP-02
A MANGO ROHIT3 FOUR 30-SEP-02
A MANGO ROHIT4 ONE 30-SEP-02
A MANGO ROHIT4 TWO 30-SEP-02
A MANGO ROHIT4 THREE 30-SEP-02
A MANGO ROHIT4 FOUR 30-SEP-02
48 rows selected.hope this is helpfull
cheers
prakash -
Insert row into database table via dynamic form -
I have developed a portlet via Portal. I used a dynamic page. I replaced the default "<ORACLE>select * from scott.emp</ORACLE>" text to call a package procedure that uses HTP.P to render the web page. My goal is to show all rows in a table and allow edits to any row, and also add a checkbox on each row to allow the user to mark for delete. I am successfully using a FOR loop and showing all of the data in a grid. My problem - How do I update and delete the data? I have a submit button with nothing behind it currently. I would ideally like to use pl/sql code to do the updates and/or deletes as marked on the page by the user, but I'm not sure how to hook the submit button to calling a procedure to execute the updates/deletes.
Any help would be appreciated -
Thanks -
KentHi Patrick - Thanks for your response! I have browsed your page quickly - very informative and I will look in more detail. My form design looks as below (using a simple example with emp id and emp name columns) - perhaps this will have to change, but I wanted the user to be able to insert using html fields id_add and name_add, then update (or mark for deletion) any of the existing rows (they are rendered with for loop in pl/sql - eg, id_1/name_1, id_2/name_2, etc for each row in the table). I was hoping the submit action would call a pl/sql that would look at all rows, and then act if an update or delete were required. This makes it difficult to use parms, I believe - I may be able to change the design to show an "update row" below the current "insert row" so that, as in your example, when the user highlights a row, it populates in the update area where changes can be made, and an update button used to effect the changes to a single row at a time.
Thanks again, I appreciate your input!
Kent
______________ _________________ <insert_button>
Emp Id (textbox) Emp Name (textbox) Del_Checkbox
______________ _________________ ___ <SUBMIT_BUTTON>
------------------------- ----------------------------- ------ -
Unable to insert rows into the table
My insert statement below is not correct, when i try run, its encoutering error "table or view does not exist".
Basically what i am doing here is collecting the table name in FOR variable which stores the table name in this variable. This variable, i am using as table. I know this is not the proper way, please let me how can insert the complete table rows with the following code.
DROP TABLE TEMP;
CREATE TABLE TEMP AS SELECT * FROM Comp WHERE 1=2;
DECLARE
I INTEGER DEFAULT 1;
S VARCHAR2(50);
begin
for C in (select TABLE_NAME INTO S from USER_TABLES where TABLE_NAME like 'CABLE%' and TABLE_NAME NOT like '%OLD' and Num_ROWS > 0 order by TABLE_NAME) loop
INSERT INTO TEMP SELECT * FROM c.TABLE_NAME;
dbms_output.put_line(c.table_name);
end loop;
end;
The above insert statement is not correct. How can i write proper way.
Thanks.
Best Regards
Arshaduser13360241 wrote:
My insert statement below is not correct, when i try run, its encoutering error "table or view does not exist".
Basically what i am doing here is collecting the table name in FOR variable which stores the table name in this variable. This variable, i am using as table. I know this is not the proper way, please let me how can insert the complete table rows with the following code.
DROP TABLE TEMP;
CREATE TABLE TEMP AS SELECT * FROM Comp WHERE 1=2;
DECLARE
I INTEGER DEFAULT 1;
S VARCHAR2(50);
begin
for C in (select TABLE_NAME INTO S from USER_TABLES where TABLE_NAME like 'CABLE%' and TABLE_NAME NOT like '%OLD' and Num_ROWS > 0 order by TABLE_NAME) loop
INSERT INTO TEMP SELECT * FROM c.TABLE_NAME;
dbms_output.put_line(c.table_name);
end loop;
end;
The above insert statement is not correct. How can i write proper way.
Thanks.
Best Regards
ArshadSTMT := 'INSERT INTO TEMP SELECT * FROM ';
STMT := STMT || S;
EXECUTE IMMEDIATE STMT; -
Inserting rows into table Based on Column Values.
Hi,
I am trying to inserting rows into a table based on Column.
Id Name
Data
N 105.1.1
http://www.example.com/New/105.1.1
U 105.1.2 http://www.example.com/Used/105.1.2
S 105.1.3 http://www.example.com/Sold/105.1.3
I want a table like this.
I want to insert Data column value based on Id and Name Columns
If Id = N and Name = 105.1.1 then Data value should be insert as http://www.example.com/New/105.1.1
If Id = U and Name = 105.1.2 then Data value should be insert as http://www.example.com/Used/105.1.2
If Id = S and Name = 105.1.3 then Data value should be insert as http://www.example.com/Sold/105.1.3
Can you please help us to write query to insert above Data Column values based on Id and Name Columns.INSERT INTO tbl (col) SELECT
CASE WHEN id='N' and Name='105.1.1 ' THEN 'http://www.example.com/New/105.1.1'
WHEN id='U' and Name='105.1.2 ' THEN 'http://www.example.com/New/105.1.2'
END col
FROM anothertbl
Sorry , cannot test it right now.
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Adding 2 more rows to a select without inserting rows to base table
hello all,
i have a below simple select statement which is querying a table.
select * from STUDY_SCHED_INTERVAL_TEMP
where STUDY_KEY = 1063;
but here is the situations. As you can see its returning 7 rows. But i need to add
2 more rows..with everything else default value or what exist... except adding 2 more rows.
i cannot insert into base table. I want my end results to increment by 2 days in
measurement_date_Taken to 01-apr-09....so basically measurement_date_taken should
end at study_end_Date...
IS THAT EVEN POSSIBLE WITHOUT INSERTING ROWS INTO THE TABLE AND JUST PLAYIHY AROUND WITH
THE SELECT STATEMENT??
sorry if this is confusing...i am on 10.2.0.3
Edited by: S2K on Aug 13, 2009 2:19 PMWell, I'm not sure if this query looks as good as my lawn, but seems to work anyway ;)
I've used the 'simplified version', but the principle should work for your table to, S2K.
As Frank already pointed out (and I stumbled upon it while clunging): you just select your already existing rows and union them with the 'missing records', you calculate the number of days you're 'missing' based on the study_end_date:
MHO%xe> alter session set nls_date_language='AMERICAN';
Sessie is gewijzigd.
Verstreken: 00:00:00.01
MHO%xe> with t as ( -- generating your data here, simplified by me due to cat and lawn
2 select 1063 study_key
3 , to_date('01-MAR-09', 'dd-mon-rr') phase_start_date
4 , to_date('02-MAR-09', 'dd-mon-rr') measurement_date_taken
5 , to_date('01-APR-09', 'dd-mon-rr') study_end_date
6 from dual union all
7 select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('04-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
8 select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('09-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
9 select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('14-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
10 select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('19-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
11 select 1063, to_date('22-MAR-09', 'dd-mon-rr') , to_date('23-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
12 select 1063, to_date('22-MAR-09', 'dd-mon-rr') , to_date('30-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual
13 ) -- actual query:
14 select study_key
15 , phase_start_date
16 , measurement_date_taken
17 , study_end_date
18 from t
19 union all
20 select study_key
21 , phase_start_date
22 , measurement_date_taken + level -- or rownum
23 , study_end_date
24 from ( select study_key
25 , phase_start_date
26 , measurement_date_taken
27 , study_end_date
28 , add_up
29 from (
30 select study_key
31 , phase_start_date
32 , measurement_date_taken
33 , study_end_date
34 , study_end_date - max(measurement_date_taken) over (partition by study_key
35 order by measurement_date_taken ) add_up
36 , lead(measurement_date_taken) over (partition by study_key
37 order by measurement_date_taken ) last_rec
38 from t
39 )
40 where last_rec is null
41 )
42 where rownum <= add_up
43 connect by level <= add_up;
STUDY_KEY PHASE_START_DATE MEASUREMENT_DATE_TA STUDY_END_DATE
1063 01-03-2009 00:00:00 02-03-2009 00:00:00 01-04-2009 00:00:00
1063 03-03-2009 00:00:00 04-03-2009 00:00:00 01-04-2009 00:00:00
1063 03-03-2009 00:00:00 09-03-2009 00:00:00 01-04-2009 00:00:00
1063 03-03-2009 00:00:00 14-03-2009 00:00:00 01-04-2009 00:00:00
1063 03-03-2009 00:00:00 19-03-2009 00:00:00 01-04-2009 00:00:00
1063 22-03-2009 00:00:00 23-03-2009 00:00:00 01-04-2009 00:00:00
1063 22-03-2009 00:00:00 30-03-2009 00:00:00 01-04-2009 00:00:00
1063 22-03-2009 00:00:00 31-03-2009 00:00:00 01-04-2009 00:00:00
1063 22-03-2009 00:00:00 01-04-2009 00:00:00 01-04-2009 00:00:00
9 rijen zijn geselecteerd.If there's a simpler way (in SQL), I hope others will join and share their example/ideas/thoughts.
I have a feeling that this is using more resources than needed.
But I've got to cut the daisies first now, they interfere my 'lawn-green-ess' ;) -
Error while inserting rows in a table
Hi,
We have recently migrated from 9i to 10g. We have a scheduled job out our DB which first deletes all the rows from a table and then inserts them back by selecting rows from 5 tables. This table has a composite primary key based on 6 columns in it. In 9i, when i try to insert rows into the table after deleting all the rows from it, I am able to insert the data successfully . However, in 10g, when i try doing the same operation, it fails with the ORA error:
ORA-00001: unique constraint violated
The same query which works perfectly in 9i fails in 10g
If anybody has some ideas on how to resolve the same, kindly let me know.
Thanks in advance.Hi,
I was finally able to resolve the reason behind that error message and found it even more weird. The error was because I was using the substr function for extracting the characters 1-4 from a column which is 5 characters long. When i specify the query as:
select substr(column1, 1, 4)) from table1;
only the characters 1-3 are retrieved. Now if i change the query to select substr(column1, 1, 5)) from table1, in that case also only 3 characters are retrieved although i have specified the substr to start from 1 and read till 5 characters. Also, when i run the query:
select length(substr(column1, 1, 4)) from table1 or select length(substr(column1, 1, 5)) from table1
I get the answer as 3.
However, the most amazing part is that the query is working perfectly in 9i and is retrieving the data correctly i.e. from substr 1-4.
Can anyone suggest what the problem could be?
Thanks
Edited by: CrazyAnie on May 13, 2009 1:34 AM -
My final data table contains a two key columns unique key constraint. I insert data into this table from a daily capture table (which also contains the two columns that make up the key in the final data table but are not constrained
(not unique) in the daily capture table). I don't want to insert rows from daily capture which already exists in final data table (based on the two key columns). Currently, what I do is to select * into a #temp table from the join
of daily capture and final data tables on these two key columns. Then I delete the rows in the daily capture table which match the #temp table. Then I insert the remaining rows from daily capture into the final data table.
Would it be possible to simplify this process by using an Instead Of trigger in the final table and just insert directly from the daily capture table? How would this look?
What is the best practice for inserting unique (new) rows and ignoring duplicate rows (rows that already exist in both the daily capture and final data tables) in my particular operation?
Rich PPlease follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
>> My final data table contains a two key columns unique key constraint. [unh? one two-column key or two one column keys? Sure wish you posted DDL] I insert data into this table from a daily capture table (which also contains the two columns that make
up the key in the final data table but are not constrained (not unique) in the daily capture table). <<
Then the "capture table" is not a table at all! Remember the fist day of your RDBMS class? A table has to have a key. You need to fix this error. What ETL tool do you use?
>> I don't want to insert rows from daily capture which already exists in final data table (based on the two key columns). <<
MERGE statement; Google it. And do not use temp tables.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Error inserting a row into a table with identity column using cfgrid on change
I got an error on trying to insert a row into a table with identity column using cfgrid on change see below
also i would like to use cfstoreproc instead of cfquery but which argument i need to pass and how to use it usually i use stored procedure
update table (xxx,xxx,xxx)
values (uu,uuu,uu)
My component
<!--- Edit a Media Type --->
<cffunction name="cfn_MediaType_Update" access="remote">
<cfargument name="gridaction" type="string" required="yes">
<cfargument name="gridrow" type="struct" required="yes">
<cfargument name="gridchanged" type="struct" required="yes">
<!--- Local variables --->
<cfset var colname="">
<cfset var value="">
<!--- Process gridaction --->
<cfswitch expression="#ARGUMENTS.gridaction#">
<!--- Process updates --->
<cfcase value="U">
<!--- Get column name and value --->
<cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
<cfset value=ARGUMENTS.gridchanged[colname]>
<!--- Perform actual update --->
<cfquery datasource="#application.dsn#">
UPDATE SP.MediaType
SET #colname# = '#value#'
WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
</cfquery>
</cfcase>
<!--- Process deletes --->
<cfcase value="D">
<!--- Perform actual delete --->
<cfquery datasource="#application.dsn#">
update SP.MediaType
set Deleted=1
WHERE MediaTypeID = #ARGUMENTS.gridrow.MediaTypeID#
</cfquery>
</cfcase>
<cfcase value="I">
<!--- Get column name and value --->
<cfset colname=StructKeyList(ARGUMENTS.gridchanged)>
<cfset value=ARGUMENTS.gridchanged[colname]>
<!--- Perform actual update --->
<cfquery datasource="#application.dsn#">
insert into SP.MediaType (#colname#)
Values ('#value#')
</cfquery>
</cfcase>
</cfswitch>
</cffunction>
my table
mediatype:
mediatypeid primary key,identity
mediatypename
my code is
<cfform method="post" name="GridExampleForm">
<cfgrid format="html" name="grid_Tables2" pagesize="3" selectmode="edit" width="800px"
delete="yes"
insert="yes"
bind="cfc:sp3.testing.MediaType.cfn_MediaType_All
({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection})"
onchange="cfc:sp3.testing.MediaType.cfn_MediaType_Update({cfgridaction},
{cfgridrow},
{cfgridchanged})">
<cfgridcolumn name="MediaTypeID" header="ID" display="no"/>
<cfgridcolumn name="MediaTypeName" header="Media Type" />
</cfgrid>
</cfform>
on insert I get the following error message ajax logging error message
http: Error invoking xxxxxxx/MediaType.cfc : Element '' is undefined in a CFML structure referenced as part of an expression.
{"gridaction":"I","gridrow":{"MEDIATYPEID":"","MEDIATYPENAME":"uuuuuu","CFGRIDROWINDEX":4} ,"gridchanged":{}}
ThanksIs this with the Travel database or another database?
If it's another database then make sure your columns
allow nulls. To check this in the Server Navigator, expand
your DataSource down to the column.
Select the column and view the Is Nullable property
in the Property Sheet
If still no luck, check out a tutorial, like Performing Inserts, ...
http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/index.jsp
John -
Read a file and insert rows into table
Hi,
i would like to know how read a file (expl.txt) with the utl_file package and after insert each row into the table (dataID).
ie :
file /tmp/expl.txt is containing :
id1 id2 describe
2 3 test1
6 5 test2
4 7 test3
and
table dataID (
id1 number,
id2 number,
describe varchar2(100));
Thanks you very much.Hello,
You can use the TEXT_IO package.
Perform an over-all search (right upper corner) on TEXT_IO, and in the results you will find a manual on how to use the package.
Hope this will help you.
Regards,
Cindy -
Insert Multiple rows into the table from that table data
Hi All,
I have a requirement like to insert mulitple rows into the table from that table data only(I need to replicate the data).
In this table primary key is composite primary key with all foreign keys.primary key also including the Date foreign key.I need to change that date at the of insertion.
INSERT
INTO myschema.Fact_page_performance
time_sk ,
batch_id ,
delta_msec ,
delta_user_msec,
error_code_sk ,
content_errs ,
element_count ,
page_bytes ,
Available ,
date_sk
VALUES
(SELECT time_sk ,
batch_id ,
delta_msec ,
delta_user_msec,
error_code_sk ,
content_errs ,
element_count ,
page_bytes ,
Available
FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
WHERE date_sk=20090509,20090510
But it is giving the error like missing Expression.
Could anyone please help to me.
Thanks and Regards
Swetha.You can have either VALUES or SELECT not both
INSERT
INTO myschema.Fact_page_performance
time_sk ,
batch_id ,
delta_msec ,
delta_user_msec,
error_code_sk ,
content_errs ,
element_count ,
page_bytes ,
Available ,
date_sk
SELECT time_sk ,
batch_id ,
delta_msec ,
delta_user_msec,
error_code_sk ,
content_errs ,
element_count ,
page_bytes ,
Available
FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
WHERE date_sk=20090509,20090510; -
Inserting multiples rows into a table using function or procedure..
How do i insert multiples rows into a table using function or procedure?
Please provide me query..Use FORALL bulk insert statement...
eg:
procedure generate_test_data as
type cl_itab is table of integer index by pls_integer;
v_cl_itab cl_itab;
type cl_vtab is table of varchar2(25) index by pls_integer;
v_cl_vtab cl_vtab;
type cl_dtab is table of date index by pls_integer;
v_cl_dtab cl_dtab;
begin
for i in 1.. 100 loop
v_cl_itab(i):= dbms_random.value(1,1000);
v_cl_vtab (i):=dbms_random.string('a',20);
v_cl_dtab (i):=to_date(trunc(dbms_random.value(2453737, 2454101)),'j');
end loop;
forall i in v_cl_itab.first .. v_cl_itab.last
execute immediate 'insert into test_order values( :n, :str , :dt ) ' using v_cl_itab(i), v_cl_vtab (i), v_cl_dtab (i);
commit;
end; -
How could I insert the deleted row into another table within a trigger?
Hi,
How could I insert the deleted row into another table within a trigger? The destination table has the same columns as the source table. Since the statements are in the trigger, it is not allowed to query the source table named 'test'. Thanks! The trigger is as follows, uncompleted:
CREATE TRIGGER delete_trigger
AFTER DELETE
ON test
FOR EACH ROW
BEGIN
-- How could I insert the deleted row into another table
END delete_trigger;
Message was edited by:
user569548Hi,
I'm not sure what's wrong there.
I read the oracle docs about ANALYZE and ALL_TAB_COLUMNS, and did the following:
ANALYZE TABLE my_tab VALIDATE STRUCTURE; //went ok.
SELECT column_name
FROM all_tab_columns
WHERE table_name = 'my_tab'; //but no rows selected?
This topic might not be what this thread should be about. Here I posted a new thread:
How to get colum names of the newly created table?
Thanks.
Message was edited by:
user569548
Maybe you are looking for
-
Editable AdvancedDataGrid / Read-only SummaryRow
tl;dr - How do I have read-only SummaryFields for an editable column in the AdvancedDataGrid? I have an AdvancedDataGrid based on flat data in a GroupingCollection that groups on one field (named "day"). There are 2 known read-only columns, and N add
-
PDF files showing some ascii characters when tried to open in adobe reader.
Hi Good day. Please help. Our business counter part is sending pdf files. But when we tried to open it using adobe pdf reader x, there are some ascii charters that shown. Any suggestion is highly appreciated. Thanks, Daryll
-
JDeveloper 12.1.3.0 - Can't associate role to user
Hello, I'm not able to associate WebLogic users to roles in JDeveloper. In a BPM project I created some roles in the current organization and I want to associate users to them. By double-clicking on one role I'm opening the Edit Role dialog. Here I s
-
Help! Lightroom freezes after installing.
I get this message after trying to create or open a catalog: "An error occured when attemting to change modules." Then Lightroom freezes. I work on a Mac and have formatted and reinstalled my systemdisk with a qlean install. I had Lightroom installed
-
Need Information about 1Z0-033
Hi i Like to write Oracle9i Database: Performance Tuning(1Z0-033) exam. And now only I am learning PL/SQL. And when i ask my instructor abt this exam(Oracle 9i Database: Performance Tuning(1Z0-033)), she told I suppose to have OCA certificate for ent