Help with simple INSERT statement?
How can I do an insert into Oracle without having to
specify EVERY field name in the table? This isn't necessary
with Access or
SQL Server, which will insert null's in the non-specified
fields, the Oracle SQL
tool tells me that there aren't enough field values when I run
this SQL Statement:
INSERT INTO TABLE_NAME VALUES (1234, 'test', 'test')
There are over 10 different fields, but I get the error message:
Native Error Code 947, Not enough values.
TIA
Kris
null
Kristofer Goss (guest) wrote:
: How can I do an insert into Oracle without having to
: specify EVERY field name in the table? This isn't necessary
: with Access or
: SQL Server, which will insert null's in the non-specified
: fields, the Oracle SQL
: tool tells me that there aren't enough field values when I run
: this SQL Statement:
: INSERT INTO TABLE_NAME VALUES (1234, 'test', 'test')
: There are over 10 different fields, but I get the error
message:
: Native Error Code 947, Not enough values.
: TIA
: Kris
You may omit the columns list, but if you do then the VALUES
clause must provide values for every column in the table.
FOR EXAMPLE: if your table were created as follows:
COLUMN_1 NOT NULL, VARCHAR2(4)
COLUMN_2 NUMBER(6)
COLUMN_3 DATE
COLUMN_4 VARCHAR2(4)
You could submit a statement like:
insert into my_table VALUES ('ALLA', , , 'XYZ');
You could also submit a statement like:
insert into my_table (column_1, column_4) VALUES ('ALLA', 'XYZ');
If you do not want to store any value in a particular column,
then that column must be allowed to accept NULLs.
Hope this helps.
null
Similar Messages
-
Looking for some help with building insert statements...
Hi, I am using some sql to build some insert statements for me to update a set of tables in our qa environments. The scripts that I have created were working great until someone added a column to some of the tables in the qa env which in turn makes my scripts break because I was simply building the statment to do someting like this...
insert into dest_table (select * from source_table@dblink);
But now when the coumns in the tables do not match it breaks...
This is the dynamic create script I use, can anyone help or suggest a better way to be able to build update statements update to qa tables when the columns are mismatched?
spool insert.sql
select
'insert into ' || table_name || ' (select * from ' || table_name || '@prod );' || chr(10) || ' commit;'
from user_tables
where table_name in
(select * from refresh_tablesl)
any help is greatly appreciated,
Thanks.See my reply to your duplicate post
looking for help building dynamic insert statements... -
Help with rewrite INSERT statement
Hi,
is there any way to rewrite this statement in 9.2.0.8 ,so I can compare execution plans ?
INSERT INTO tasks
(id , data
(SELECT :b17, NVL (:b12, SYSDATE)
FROM DUAL
WHERE EXISTS (
SELECT 1
FROM queue_definitions
WHERE df_id = :b17
AND ( df_max_depth = 0
OR df_max_depth >
(SELECT COUNT (*)
FROM tasks
WHERE t_df_id = :b17 AND t_audit_stat != 0)
Regards
GregGGregG wrote:
Hi,
is there any way to rewrite this statement in 9.2.0.8 ,so I can compare execution plans ?
INSERT INTO tasks
(id , data
(SELECT :b17, NVL (:b12, SYSDATE)
FROM DUAL
WHERE EXISTS (
SELECT 1
FROM queue_definitions
WHERE df_id = :b17
AND ( df_max_depth = 0
OR df_max_depth >
(SELECT COUNT (*)
FROM tasks
WHERE t_df_id = :b17 AND t_audit_stat != 0)
)));Regards
GregGCan you eliminate the DUAL portion of the select, putting the insert bind varibles where 'SELECT 1' is instead using ROWNUM to restrict the number of rows to 1? -
Help with simple sql statement usiing Rank function..
Hello I have very important question..this is how i have a dataset...
This is the Log Table
And the actual Table holds the current value. 12345
Current Table
12345 575 232 4567
Log Table Values
Objectid InvalidatedTime
PhoneArea
Phoneno Rank
12345 2014-04-23
570
822-4438 0
3
12345 2014-04-28
NULL
658-7789 0
2
12345 2014-05-09
578
658-8521 0
1
As you can see on 23 they invlalidated the areacode and phone no and changed it to .. 578 658-8521 but on 04-28 they just changed the phone no and not the area code..
I want the result set to be like this
Date Fromvalue
ToValue
2014-04-23
570-822-4438
578 658-7789
2014-04-28 578 658-7789
578 658-8521
2014-05-09 578 658-8521
575
232 4567
I have tried this code..
select
--'Home Phone',
--tt.invalidationtime ,
--Case when
-- tt.*,tt_prev.* --,
'Home Phone' as PropertyName,
tt.invalidationtime,
case when tt.rank1 = 1 then tt.phoneareacode+'-'+tt.phoneno
when tt.rank1 <> 1 then Isnull(tt.phoneareacode,tt_prev.phoneareacode)+'-'+ isnull(tt.phoneno,tt_prev.phoneno)
end as FromAddress,
case when tt.rank1 = 1 then Haddress.phoneareacode+'-'+HAddress.phoneno
when tt.rank1 <> 1 then Isnull(tt_prev.phoneareacode,tt.phoneareacode)+'-'+isnull(tt_prev.phoneno,tt.phoneno)
end as ToPhone
from
#Phone_Final tt
left join #Phone_Final tt_prev on tt_prev.objectid = tt.objectid and tt.rank1-11 = tt_prev.rank1
inner join (select * from Soarian_Clin_Prd_1.dbo.Haddress where PP_id = 2346 and Addresstype = 0) Haddress
Can you please tell me what is wrong here..should be this I reckon
;With CTE
AS
SELECT ROW_NUMBER() OVER (PARTITION BY ObjectID ORDER BY InvalidatedTime) AS Seq, *
FROM
SELECT ObjectID,InvalidatedTime,PhoneArea,Phoneno,Rank
FROM LogTable
UNION ALL
SELECT ObjectID, GETDATE(),PhoneArea,Phoneno,NULL
FROM Current
)t
SELECT c1.InvalidatedDate AS [Date],
COALESCE(c1.PhoneArea,c2.PhoneArea,'') + c1.Phoneno AS FromValue,
COALESCE(c2.PhoneArea,c1.PhoneArea,'') + c2.Phoneno AS ToValue
FROM CTE c1
INNER JOIN CTE c2
ON c2.Objectid = c1.Objectid
AND c2.Seq = c1.Seq + 1
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Need help with the session state value items.
I need help with the session state value items.
Trigger is created (on After delete, insert action) on table A.
When insert in table B at least one row, then trigger update value to 'Y'
in table A.
When delete all rows from a table B,, then trigger update value to 'N'
in table A.
In detail report changes are visible, but the trigger replacement value is not set in session value.
How can I implement this?You'll have to create a process which runs after your database update process that does a query and loads the result into your page item.
For example
SELECT YN_COLUMN
FROM My_TABLE
INTO My_Page_Item
WHERE Key_value = My_Page_Item_Holding_Key_ValueThe DML process will only return key values after updating, such as an ID primary key updated by a sequence in a trigger.
If the value is showing in a report, make sure the report refreshes on reload of the page.
Edited by: Bob37 on Dec 6, 2011 10:36 AM -
Simple Insert Statement Not Working
This problem is just driving me crazy. I dont know what I m
doing wrong here. The code works fine on my localhost but giving
problem on the live site. It is a simple insert statement like
this:
insert into tblSubImages(productid, title, subdescription,
image, place)
values(#form.productid#,'#form.title#','#form.subdescription#','#uploadedimage#',
#form.place#)
The error I m getting looks like this:
Syntax error in INSERT INTO statement.
The error occurred in
D:\Hosting\davedhillon\superprinters\admin\addaditional.cfm: line
11
9 : <cfset uploadedImage = cffile.serverfile>
10 : <cfquery name="insertadditional"
datasource="#super.dsn#">
11 : insert into tblSubImages(productid, title,
subdescription, image)
values(#form.productid#,'#form.title#','#form.subdescription#','#uploadedimage#')
12 : </cfquery>
13 :
SQL insert into tblSubImages(productid, title,
subdescription, image)
values(1,'ewr','werw','FamilyRoomBedroom.jpg')
DATASOURCE davedhillon_accesscf_super
VENDORERRORCODE 3092
You can see it is the simple insert statement which I have
worked with so many times. Why has it started giving problem all of
a sudden?
Thank youTry copying and pasting the SQL statement produced in the
error into your DB's query analyzer and try running it, as it might
produce a more useful error message so you can see where the
problem exists in the SQL statement. Also, I think I've seen that
3092 code before and it means there is a reserved word violation so
cf_dev2 solution will probably solve it.
CoolJJ -
Help with this update statement..
Hi everyone,
I am trying to update a column in a table .I need to update that column
with a function that takes patient_nbr and type_x column values as a parameter.
That table has almost "300,000" records. It is taking long time to complete
almost 60 min to 90 min.
Is it usual to take that much time to update that many records?
I dont know why it is taking this much time.Please help with this update statement.
select get_partner_id(SUBSTR(patient_nbr,1,9),type_x) partner_id from test_load;
(it is just taking 20 - 30 sec)
I am sure that it is not the problem with my function.
I tried the following update and merge statements .Please correct me if i am wrong
in the syntax and give me some suggestions how can i make the update statement fast.
update test_load set partner_id = get_partner_id(SUBSTR(patient_nbr,1,9),type_x);
merge into test_load a
using (select patient_nbr,type_x from test_load) b
on (a.patient_nbr = b.patient_nbr)
when matched
then
update
set a.partner_id = get_partner_id(SUBSTR(b.patient_nbr,1,9),b.type_x);
there is a index on patient_nbr column
and the statistics are gathered on this table.Hi Justin,
As requested here are the explain plans for my update statements.Please correct if i am doing anything wrong.
update test_load set partner_id = get_partner_id(SUBSTR(patient_nbr,1,9),type_x);
"PLAN_TABLE_OUTPUT"
"Plan hash value: 3793814442"
"| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |"
"| 0 | UPDATE STATEMENT | | 274K| 4552K| 1488 (1)| 00:00:18 |"
"| 1 | UPDATE | TEST_LOAD | | | | |"
"| 2 | TABLE ACCESS FULL| TEST_LOAD | 274K| 4552K| 1488 (1)| 00:00:18 |"
merge into test_load a
using (select patient_nbr,type_x from test_load) b
on (a.patient_nbr = b.patient_nbr)
when matched
then
update
set a.partner_id = get_partner_id(SUBSTR(b.patient_nbr,1,9),b.type_x);
"PLAN_TABLE_OUTPUT"
"Plan hash value: 1188928691"
"| Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time |"
"| 0 | MERGE STATEMENT | | 274K| 3213K| | 6660 (1)| 00:01:20 |"
"| 1 | MERGE | TEST_LOAD | | | | | |"
"| 2 | VIEW | | | | | | |"
"|* 3 | HASH JOIN | | 274K| 43M| 7232K| 6660 (1)| 00:01:20 |"
"| 4 | TABLE ACCESS FULL| TEST_LOAD | 274K| 4017K| | 1482 (1)| 00:00:18 |"
"| 5 | TABLE ACCESS FULL| TEST_LOAD | 274K| 40M| | 1496 (2)| 00:00:18 |"
"Predicate Information (identified by operation id):"
" 3 - access("A"."patient_nbr"="patient_nbr")"Please give some suggestions..
what's the best approach for doing the updates for huge tables?
Thanks -
Inserting multiple rows with single insert statement ?
Hi ,,
Consider a PL/SQL procedure.
I want to pass an array of values and insert in a table with a single statement.
Moreover I want to call this procedure to insert multiple rows from OCI program.
Can some body help ? :(
Thanks
ChanduHi Vincent,
Regular array insert which you have mentioned works in case of insert statement(This is to eliminate multiple calls to server)
Will it work for passing array to Stored procedure, in this case procedure will be called only once with an array.
It will be of great help if you give an example.
Thanks
Chandra -
Urgent help with simple BPEL process for reading data from database
Hello there,
I need help with BPEL project.
i have created a table Employee in Database.
I did create application, BPEL project and connection to the database properly using Database Adapter.
I need to read the records from the database and convert into xml fomat and it should to go approval for BPM worklist.
Can someone please describe me step by step what i need to do.
Thx,
DpsI have created a table in Database with data like Empno,name,salary,comments.
I created Database Connection in jsp page and connecting to BPEL process.
It initiates the process and it goes automatically for approval.
Please refer the code once which i created.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.Map" %>
<%@page import="com.oracle.bpel.client.Locator" %>
<%@page import="com.oracle.bpel.client.NormalizedMessage" %>
<%@page import="com.oracle.bpel.client.delivery.IDeliveryService" %>
<%@page import="javax.naming.Context" %>
<%@page import="java.util.Hashtable" %>
<%@page import="java.util.HashMap" %>
<%@ page import="java.sql.*"%>
<%@ page import= "jspprj.DBCon"%>
<html>
<head>
<title>Invoke CreditRatingService</title>
</head>
<body>
<%
DBCon dbcon=new DBCon();
Connection conn=dbcon.createConnection();
Statement st=null;
PreparedStatement pstmt=null;
Hashtable env= new Hashtable();
ResultSet rs = null;
Map payload =null;
try
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.PROVIDER_URL, "opmn:ormi://localhost:port:home/orabpel");//bpel server
env.put("java.naming.security.principal", "username");
env.put("java.naming.security.credentials", "password");//bpel console
Locator locator = new Locator("default","password",env);
IDeliveryService deliveryService =
(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
// construct the normalized message and send to Oracle BPEL Process Manager
NormalizedMessage nm = new NormalizedMessage();
java.util.HashMap map = new HashMap();
st=conn.createStatement();
out.println("connected");
String query1="Select * from EMPLOYEE";
rs=st.executeQuery(query1);
/*reading Data From Database and converting into XML format
so that no need of going to BPEL console and entering the details.
while (rs.next()){
String xml1 = "<AsynchBPELProcess1ProcessRequest xmlns='http://xmlns.oracle.com/AsynchBPELProcess1'>"+
"<Empno>"+rs.getString(1)+"</Empno>"+
"<EmpName>"+rs.getString(2)+"</EmpName>"+
"<Salary>"+rs.getString(3)+"</Salary>"+
"<Comments>"+rs.getString(4)+"</Comments>"+
"</AsynchBPELProcess1ProcessRequest>";
out.println(xml1);
nm.addPart("payload", xml1 );
// EmployeeApprovalProcess is the BPEL process in which human task is implemented
deliveryService.post("EmployeeApprovalProcess", "initiate", nm);
// payload = res.getPayload();
out.println( "BPELProcess CreditRatingService executed!<br>" );
// out.println( "Credit Rating is " + payload.get("payload") );
//Incase there is an exception while invoking the first server invoke the second server i.e lsgpas13.
catch(Exception ee) {
//("BPEL Server lsgpas14 invoking error.\n"+ee.toString());
%>
</body>
</html>
Its working fine.And i want it for Bulk approvals.please help me step by step procedure if any other way to implement this. -
Help with the insert table/form tool in BIP 10.1.3.2.1
Hi, I'm trying to use the insert table/form tool in BIP, and running into some issues that I don't understand. First off, my data coming in looks like this (left column of tool):
Rowset
--- Row
------ Customer ID
------ Customer Name
------ Customer City
------ Product
------ Amount Sold
I would like the output to do the following:
a) have one page per customer. Customer should be determined by customer ID, and has attributes of customer ID, customer Name, Customer City
b) Show a table of all products and the total Amount Sold by product for that customer
c) Give a "grand total" for the customer
Can someone help with the steps needed to do this? I've tried several variations of the following without much luck:
1) Added Rowset and all children to the "Template" pane
2) Clicked on the "Row" group, and set Grouping = Customer ID, with a break of "New page per Element"
3) Clicked on the newly created (from step 2) Cust ID group, and set it to group by Product
4) Moved "amount sold" to be at same level as Product
5) Moved all of the customer attributes (name, address, etc.) to be at same level as Cust ID
6) On the Cust ID level, set the style to table
7) on row and rowset levels, set style to free form
This seems to be VERY close, except that it isn't creating a total amount for the sum of all products purchased by a customer. What do I need to do inside the tool to get a total per customer to show up?
Thanks in advance!
Scott
p.s. the final hierarchy in the template window looks like this:
Rowset (style = freeform, no grouping/sort by/breaks)
--- Row (style = freeform, group by customer ID, break new page per element)
------ Customer ID (style = table, group by product, no breaks)
--------- Product (nothing special)
--------- Amount Sold (calc for grouping = SUM)
------ Customer Name (nothing special)
------ Customer City (nothing special)
Thanks very much for the help!
ScottTo anyone else who sees this post, the answer is to do the following. Insert the Amount Sold field using the "Insert Field" tool, and set the function to sum, with the grouping checkbox turned on.
Thanks,
Scott -
I was wondering if someone could help me with a simple bit of action script 3. I need to make a movie clip (single_mc) disappear when the user clicks on the mouse (stop_btn). Here’s what I have so far.
function setProperty(event:MouseEvent):void
single_mc.alpha=0;
stop_btn.addEventListener(MouseEvent.CLICK, setProperty);
Also I was wonder if you could recommend an Action script 3 book for me. I would like one that is not a training book, but has situations and then the script written out. For example: I click a button and a movie symbol disappears from the stage. I am a graphic artist, that from time to time, needs simple interaction in flash, but cant justify the time to learn the script.
Thanks for your timeuse the snippets panel to help with you with sample code for basic tasks.
function setProperty(event:MouseEvent):void
single_mc.visible=false;
stop_btn.addEventListener(MouseEvent.CLICK, setProperty); -
Please help with simple Drag N Drop
I’m desperate and need some help with this simple drag
and drop. Here is the scenario…this animation is for a
kindergarten course. I have 6 different colored teddy bears on the
floor and the bears are to be placed on the middle shelf in the
room, in no particular order. I have the code in place to drag the
bears, and they return to their original location if dropped in the
wrong area. Everything works, except I can’t make the bears
stick to the target area. The target area has to be the same for
all 6 bears. Can someone help me out with this?
I have a feeling that the problem has something to do with my
instance names, but I have tried everything I can think of and
cannot get it to work. Is there some way I can post, send, or
attach my .fla file for someone to look at? I’m desperate.
PLEASE HELP!var startX3:Number;
var startY3:Number;
var counter3:Number=0;
vf_A.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_A.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
vf_E.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_E.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
vf_I.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_I.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
vf_O.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_O.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
vf_U.addEventListener(MouseEvent.MOUSE_DOWN, pickUp3);
vf_U.addEventListener(MouseEvent.MOUSE_UP, dropIt3);
function pickUp3(event:MouseEvent):void {
event.target.startDrag(true);
reply2_txt.text="";
event.target.parent.addChild(event.target);
startX2=event.target.x;
startY2=event.target.y;
function dropIt3(event:MouseEvent):void {
event.target.stopDrag();
var myTargetName:String="target"+event.target.name;
var myTarget:DisplayObject=getChildByName(myTargetName);
if (event.target.dropTarget != null &&
event.target.dropTarget.name == "instance112") {
reply2_txt.text="Good Job!";
event.target.removeEventListener(MouseEvent.MOUSE_DOWN,
pickUp3);
event.target.removeEventListener(MouseEvent.MOUSE_UP,
dropIt3);
event.target.buttonMode=false;
event.target.x=myTarget.x;
event.target.y=myTarget.y;
var mySound:Sound = new vowels_NAR_goodjob();
mySound.play();
counter3++;
} else {
reply2_txt.text="Try Again!";
event.target.x=startX2;
event.target.y=startY2;
var mySound2:Sound = new vowel_NAR_nopetryagain();
mySound2.play();
if (counter2==5) {
reply2_txt.text="Great Job! You did it!";
gotoAndPlay(3300);
vf_A.buttonMode=true;
vf_E.buttonMode=true;
vf_I.buttonMode=true;
vf_O.buttonMode=true;
vf_U.buttonMode=true; -
Please help me with a CASE Statement:
- When ID = 15, 16, 17, 18 then "Bad"
- when ID = 19, then "Average"
- when ID = 21, then "Good"
- else "Null"
Thank you!!Well the 1st thing to do would be to correct my poor spelling... change Delault : to Default :
Don't know why you would get an error stating "The result of selection formula must be a boolean". It's working fine on my machine.
If your ID field is numbers stored text you have a couple different options...
1) Convert the ID to a number...
Select ToNumber({home.noone_ID})
2) Wrap the ID values in double quotes...
Case "15", "16", "17", "18" :
"BAD"
Even if this were your problem... the error should be something other than the boolean thing...
Jason -
Help with a return statement please!
hey, just hoping somone can help me with this return statement
i have to add a method called "specialReport" this method takes a year as it's parameter. if the parameter is not a year between 1930 and 1969 inclusive it displays an error message, "not a valid year"
if the parameter is a valid year, then it compares the parameter with the year field. if they are the same, and is the movie has been rented at least five times, the method will display the message "a good year for movies" if the years are different or the movie has NOT been rented at least five times, the method displays the message "try a different year"
btw, the Year field is : yearReleased
all help is very much appreciated!public void specialReport(int year){
//add functionality to process here
return;
} -
Deadlocks with simple UPDATE statement
I have in a C# program a dictionary and in SQL Server a stored procedure with a simple UPDATE statement. I process the dictionary in parallel. For each entry in my dictionary I call this stored procedure and I am getting deadlocks.
This is the UPDATE statement:
ALTER PROCEDURE [dbo].[UpdateImages]
@ICRTCode nvarchar(max),
@ICRTImage nvarchar(max)
AS
BEGIN
UPDATE Images SET processed = '1', Image = @ICRTImage, ProcessDate = GETDATE() WHERE IDICRT = @ICRTCode
END
Can someone give me a hint as to why this would cause deadlocks? There are no other processes writing to this table. This is a table in a staging database.http://blogs.msdn.com/bartd/archive/2006/09/09/747119.aspx
http://blogs.msdn.com/bartd/archive/2006/09/25/770928.aspx
Try change the statement a little bit
UPDATE Images SET processed = '1', Image = @ICRTImage, ProcessDate = GETDATE()
FROM
Images
WITH (TABLOCK) WHERE IDICRT = @ICRTCode
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
Maybe you are looking for
-
XML Publisher report giving XML tag output
Dear All, Please note that we need to convert the standard report 'Bill of Material Comparison Report' to XML Publisher report. But we were not able to get the desired PDF output instead it shows only XML output. This report is not a direct concurren
-
This copy of iTunes is corrupted or not installed properly ? Help
Hi, After starting up iTunes I received en error message: "This copy of iTunes is corrupted or not installed properly". So I downloaded the latest version via apple but it fails to re-install because there is already a later version of iTunes on my m
-
Full width responsive layout in Muse
I'm working on a website for a client and they want a site that has full browser width content however I can't seem to get my objects to span the whole browser and resize properly in relation to browser window size. I figured out how to make a rectan
-
Does anyone know of any documentation or anywhere else that I could find information that compares document management solutions between SAP KM and Documentum? Thanks, points will be awarded for anything that is helpful.
-
How can i unlock iphone 4s in china
My friend bought an iphone 4s 32gb from Sprint and sent it to me in China, but i cant find any place to unlock the iphone not even apple i bought this phone in Jan and havent got chance to use it how can i unlock it in China? and how do i activite m