Help needed in inserting data using a query
I need to have some data as a result of the following query:
select sched_num,load_id,ord_id,split_id from ord_load_seq
where (ord_id,split_id,sched_num) in (select ord_id,split_id,sched_num from ord_load_seq where seq_num = '2'
group by ord_id,split_id,sched_num having count(1) >1)
order by ord_id,split_id,sched_num;
But currently it retunrns no rows. The problem is in the having count(1)> 1 clause.
When i make =1, it returns rows. But no rows on > 1. I even tried inserting some rows to get the result >1
But still the query on a whole returns no rows.Please help.
ohhh... lets start our lesson children:
here is code to consider:
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.2.0
SQL>
SQL> --Q1
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 3 fld3 from dual
7 union all
8 select 1 fld1, 2 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 3 fld2, 3 fld3 from dual)
11 select fld1, fld2, fld3 from tbl
12 order by fld1, fld2, fld3
13 /
FLD1 FLD2 FLD3
1 1 1
1 1 2
1 1 3
1 2 3
1 3 3
SQL> --Q2
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 3 fld3 from dual
7 union all
8 select 1 fld1, 2 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 3 fld2, 3 fld3 from dual)
11 select fld1, fld2, fld3, count(1) from tbl
12 group by fld1,fld2,fld3
13 order by fld1, fld2, fld3
14 /
FLD1 FLD2 FLD3 COUNT(1)
1 1 1 1
1 1 2 1
1 1 3 1
1 2 3 1
1 3 3 1
SQL> --Q3
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 3 fld3 from dual
7 union all
8 select 1 fld1, 2 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 3 fld2, 3 fld3 from dual)
11 select fld1, fld2, fld3 from tbl
12 group by fld1,fld2,fld3
13 having count(1) > 1
14 order by fld1, fld2, fld3
15 /
FLD1 FLD2 FLD3
SQL> --Q4
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 2 fld3 from dual
7 union all
8 select 1 fld1, 1 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 2 fld2, 3 fld3 from dual
11 union all
12 select 1 fld1, 3 fld2, 3 fld3 from dual)
13 select fld1, fld2, fld3 from tbl
14 order by fld1, fld2, fld3
15 /
FLD1 FLD2 FLD3
1 1 1
1 1 2
1 1 2
1 1 3
1 2 3
1 3 3
6 rows selected
SQL> --Q5
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 2 fld3 from dual -- inserted duplicate row
7 union all
8 select 1 fld1, 1 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 2 fld2, 3 fld3 from dual
11 union all
12 select 1 fld1, 3 fld2, 3 fld3 from dual)
13 select fld1, fld2, fld3, count(1) from tbl
14 group by fld1,fld2,fld3
15 order by fld1, fld2, fld3
16 /
FLD1 FLD2 FLD3 COUNT(1)
1 1 1 1
1 1 2 2
1 1 3 1
1 2 3 1
1 3 3 1
SQL> --Q6
SQL> with tbl as
2 (select 1 fld1, 1 fld2, 1 fld3 from dual
3 union all
4 select 1 fld1, 1 fld2, 2 fld3 from dual
5 union all
6 select 1 fld1, 1 fld2, 2 fld3 from dual -- inserted duplicate row
7 union all
8 select 1 fld1, 1 fld2, 3 fld3 from dual
9 union all
10 select 1 fld1, 2 fld2, 3 fld3 from dual
11 union all
12 select 1 fld1, 3 fld2, 3 fld3 from dual)
13 select fld1, fld2, fld3 from tbl
14 group by fld1,fld2,fld3
15 having count(1) > 1
16 order by fld1, fld2, fld3
17 /
FLD1 FLD2 FLD3
1 1 2
SQL> Q1. As you may see we have an bunch of data where each row is unique combination of the columns value.
Q2. lets try to group it by fld1 and fld2 and fld3 columns. We don't expect any miracle and got the same data as Q1. Why? Because each row is unique combination(group) in scope of fld1, fld2, fld3 - count(1) exactly shows us that.
Q3. Q2 is explanation why we got no rows filter (having count(1) > 1)because the result of the clause is always false.
Q4. Lets put some duplication.
Q5. Now we got some new result. Count shows us group with more then one rows.
Q6. Shows us exact group which we've found in Q5.
Similar Messages
-
Urgent help needed in inserting data into a custom table in oracle WorkFlow
Hi
I am trying to get data from the WF and insert into a custom table..
I read that workflow procedures WONT allow commits...
Oracle Workflow will not support autonomous commits in any procedure it calls directly. If you need to perform commits, then embed your SQL in a subprocedure and declare it as an autonomous block. This subprocedure must be capable of being rerun. Additionally, note that Oracle Workflow handles errors by rolling back the entire procedure and setting its status to ERROR. Database updates performed by autonomous commits cannot be rolled back, so you will need to write your own compensatory logic for error handling
Have anyone did this..
Please give me some idea ...It is urgent
I am getting data using getitemattribute..and try to insert it into a custom table
thanks
kpPl do not post duplicate threads - insert dont work in Workflow
Srini -
Help needed to insert data from different database
Hi ,
I have a requirement where i need to fetch data from different database through database link .Depending on user request , the dblink needs to change and data from respective table from mentioned datbase has to be fetched and populated .Could i use execute immediate for this, would dblink work within execute immediate .If not , could pls let me know any other approach .What does "the dblink needs to change" mean?
Are you trying to dynamically create database links at run-time? Or to point a query at one of a set of pre-established database links at run-time?
Are you sure that you really need to get the data from the remote database in real time? Could you use materialized views/ Streams/ etc to move the data from the remote databases to the local database? That tends to be far more robust.
Justin -
Help needed to load data using sql loader.
Hi,
I trying to load data from xls to oracle table(solaris OS) and its failing to load data.
Control file:
LOAD DATA
CHARACTERSET UTF16
BYTEORDER BIG ENDIAN
INFILE cost.csv
BADFILE consolidate.bad
DISCARDFILE Sybase_inventory.dis
INSERT
INTO TABLE FIT_UNIX_NT_SERVER_COSTS
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
HOST_NM,
SERVICE_9071_DOLLAR DOUBLE,
SERVICE_9310_DOLLAR DOUBLE,
SERVICE_9700_DOLLAR DOUBLE,
SERVICE_9701_DOLLAR DOUBLE,
SERVICE_9710_DOLLAR DOUBLE,
SERVICE_9711_DOLLAR DOUBLE,
SERVICE_9712_DOLLAR DOUBLE,
SERVICE_9713_DOLLAR DOUBLE,
SERVICE_9720_DOLLAR DOUBLE,
SERVICE_9721_DOLLAR DOUBLE,
SERVICE_9730_DOLLAR DOUBLE,
SERVICE_9731_DOLLAR DOUBLE,
SERVICE_9750_DOLLAR DOUBLE,
SERVICE_9751_DOLLAR DOUBLE,
GRAND_TOTAL DOUBLE
Log file:
Table FIT_UNIX_NT_SERVER_COSTS, loaded from every logical record.
Insert option in effect for this table: INSERT
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
HOST_NM FIRST * , CHARACTER
SERVICE_9071_DOLLAR NEXT 8 DOUBLE
SERVICE_9310_DOLLAR NEXT 8 DOUBLE
SERVICE_9700_DOLLAR NEXT 8 DOUBLE
SERVICE_9701_DOLLAR NEXT 8 DOUBLE
SERVICE_9710_DOLLAR NEXT 8 DOUBLE
SERVICE_9711_DOLLAR NEXT 8 DOUBLE
SERVICE_9712_DOLLAR NEXT 8 DOUBLE
SERVICE_9713_DOLLAR NEXT 8 DOUBLE
SERVICE_9720_DOLLAR NEXT 8 DOUBLE
SERVICE_9721_DOLLAR NEXT 8 DOUBLE
SERVICE_9730_DOLLAR NEXT 8 DOUBLE
SERVICE_9731_DOLLAR NEXT 8 DOUBLE
SERVICE_9750_DOLLAR NEXT 8 DOUBLE
SERVICE_9751_DOLLAR NEXT 8 DOUBLE
GRAND_TOTAL NEXT 8 DOUBLE
Record 1: Rejected - Error on table FIT_UNIX_NT_SERVER_COSTS, column HOST_NM.
Field in data file exceeds maximum length
Table FIT_UNIX_NT_SERVER_COSTS:
0 Rows successfully loaded.
1 Row not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Please help me ASAP.
Awaiting u r reply.Hi,
I verified and everything looks fine according to me.
Table structure:
OST_NM VARCHAR2(30)
SERVICE_9071_DOLLAR NUMBER(8,2)
SERVICE_9310_DOLLAR NUMBER(8,2)
SERVICE_9700_DOLLAR NUMBER(8,2)
SERVICE_9701_DOLLAR NUMBER(8,2)
SERVICE_9710_DOLLAR NUMBER(8,2)
SERVICE_9711_DOLLAR NUMBER(8,2)
SERVICE_9712_DOLLAR NUMBER(8,2)
SERVICE_9713_DOLLAR NUMBER(8,2)
SERVICE_9720_DOLLAR NUMBER(8,2)
SERVICE_9721_DOLLAR NUMBER(8,2)
SERVICE_9730_DOLLAR NUMBER(8,2)
SERVICE_9731_DOLLAR NUMBER(8,2)
SERVICE_9750_DOLLAR NUMBER(8,2)
SERVICE_9751_DOLLAR NUMBER(8,2)
GRAND_TOTAL NUMBER(8,2)
Control file:
LOAD DATA
BYTEORDER BIG ENDIAN
INFILE cost.csv
BADFILE consolidate.bad
DISCARDFILE Sybase_inventory.dis
INSERT
INTO TABLE FIT_UNIX_NT_SERVER_COSTS
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
HOST_NM ,
SERVICE_9071_DOLLAR NUMBER(8,2),
SERVICE_9310_DOLLAR NUMBER(8,2),
SERVICE_9700_DOLLAR NUMBER(8,2),
SERVICE_9701_DOLLAR NUMBER(8,2),
SERVICE_9710_DOLLAR NUMBER(8,2),
SERVICE_9711_DOLLAR NUMBER(8,2),
SERVICE_9712_DOLLAR NUMBER(8,2),
SERVICE_9713_DOLLAR NUMBER(8,2),
SERVICE_9720_DOLLAR NUMBER(8,2),
SERVICE_9721_DOLLAR NUMBER(8,2),
SERVICE_9730_DOLLAR NUMBER(8,2),
SERVICE_9731_DOLLAR NUMBER(8,2),
SERVICE_9750_DOLLAR NUMBER(8,2),
SERVICE_9751_DOLLAR NUMBER(8,2),
GRAND_TOTAL NUMBER(8,2)
Sample date file:
ABOS12,122.46,,1315.00,,1400.00,,,,,,,,1855.62,,4693.07
ABOS39,6391.16,,1315.00,,1400.00,,,,,,,,,4081.88,13188.04 -
Error while insert data using execute immediate in dynamic table in oracle
Error while insert data using execute immediate in dynamic table created in oracle 11g .
first the dynamic nested table (op_sample) was created using the executed immediate...
object is
CREATE OR REPLACE TYPE ASI.sub_mark AS OBJECT (
mark1 number,
mark2 number
t_sub_mark is a class of type sub_mark
CREATE OR REPLACE TYPE ASI.t_sub_mark is table of sub_mark;
create table sam1(id number,name varchar2(30));
nested table is created below:
begin
EXECUTE IMMEDIATE ' create table '||op_sample||'
(id number,name varchar2(30),subject_obj t_sub_mark) nested table subject_obj store as nest_tab return as value';
end;
now data from sam1 table and object (subject_obj) are inserted into the dynamic table
declare
subject_obj t_sub_mark;
begin
subject_obj:= t_sub_mark();
EXECUTE IMMEDIATE 'insert into op_sample (select id,name,subject_obj from sam1) ';
end;
and got the below error:
ORA-00904: "SUBJECT_OBJ": invalid identifier
ORA-06512: at line 7
then when we tried to insert the data into the dynam_table with the subject_marks object as null,we received the following error..
execute immediate 'insert into '||dynam_table ||'
(SELECT887684 wrote:
ORA-00904: "SUBJECT_OBJ": invalid identifier
ORA-06512: at line 7The problem is that your variable subject_obj is not in scope inside the dynamic SQL you are building. The SQL engine does not know your PL/SQL variable, so it tries to find a column named SUBJECT_OBJ in your SAM1 table.
If you need to use dynamic SQL for this, then you must bind the variable. Something like this:
EXECUTE IMMEDIATE 'insert into op_sample (select id,name,:bind_subject_obj from sam1) ' USING subject_obj;Alternatively you might figure out to use static SQL rather than dynamic SQL (if possible for your project.) In static SQL the PL/SQL engine binds the variables for you automatically. -
IIf condition between dates using mdx query
Hi,
how to check IIF condition between dates using mdx query.
I able to check single year,plese check below mdx query.I need to check members between years.
my requirement is member is belongs to between years(2007 to 2010),display "yes" else "NO";
Could you please give me exact mdx query.
From,to-2007,2010,if member belongs to 2007to 2010 then disply "yes"else "no".
how to pass two members in IIf condition.
WITH
MEMBER Measures.[test]
AS Iif([Date].[Calendar Year].currentmember
is [Date].[Calendar Year].&[2007],"no","yes")
SELECT {Measures.[test]}
on 0
,[Product].[Subcategory].[Subcategory].MEMBERS * [Date].[Calendar Year].[Calendar Year]
ON 1
FROM [Adventure Works]
induHi Sriindu,
consider the following:
WITH
MEMBER measures.[test] AS
IIF
Exists
[Date].[Calendar Year].CurrentMember
[Date].[Calendar Year].&[2007] : [Date].[Calendar Year].&[20010]
).Item(0)
IS
[Date].[Calendar Year].CurrentMember
,"yes"
,"no"
SELECT
{measures.[test]} ON 0
[Product].[Subcategory].[Subcategory].MEMBERS
[Date].[Calendar Year].[Calendar Year] ON 1
FROM [Adventure Works];
Philip, -
Access pre-insert data using ViewObjects
Hi,
I’m trying to access pre-insert data (before super.doCommit() execution) using viewobjects, but I only obtain committed data. Is it possible to obtain pre-insert data using viewobjects?
Here the Java code:
String amDef = "oracle.srdemo.model.AppModule";
String config = "AppModuleLocal";
ApplicationModule am =
Configuration.createRootApplicationModule(amDef, config);
ViewObject vo = am.findViewObject("DatetestView1");
System.out.println("Query will return "+ vo.getEstimatedRowCount()+" rows...");
vo.executeQuery();
while (vo.hasNext()) {
Row curPerson = vo.next();
System.out.println(vo.getCurrentRowIndex()+". "+
curPerson.getAttribute("Id")+" "+
curPerson.getAttribute("Dataini"));
Configuration.releaseRootApplicationModule(am, true);
I'm using JDeveloper 11g, a Fusion Web Application and ADF Business Components
Thanks in advance.Hi Timo,
According to your instructions, I obtained current ApplicationModule and the issue was solved.
Here the Java Code to get ApplicationModule from Iterator:
BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
DCIteratorBinding dciter = (DCIteratorBinding)bindings.get("DatetestView1Iterator");
DCDataControl dc = dciter.getDataControl();
ApplicationModule am = (ApplicationModule)dc.getDataProvider();
AppModuleImpl am2 = (AppModuleImpl)am;
ViewObject vo = (DatetestViewImpl)am2.findViewObject("DatetestView1");
Thank you vey much,
Olga -
Restful service unable to insert data using PL/SQL.
Hi all,
Am running: AL 2.01 standalone mode on OEL 4.8 in VM box A.
Oracle database 10.2.0.4 with Apex 4.2.0.00.27 on OEL4.8 in VM box B.
Able to performed oracle.example.hr Restful services with no problem.
Unable to insert data using AL 2.0.1 but works on AL 1.1.4.
which uses the following table (under schema: scott):
create table json_demo ( title varchar2(20), description varchar2(1000) );
grant all on json_demo to apex_public_user; and below procedure ( scott's schema ):
CREATE OR REPLACE
PROCEDURE post(
p_url IN VARCHAR2,
p_message IN VARCHAR2,
p_response OUT VARCHAR2)
IS
l_end_loop BOOLEAN := false;
l_http_req utl_http.req;
l_http_resp utl_http.resp;
l_buffer CLOB;
l_data VARCHAR2(20000);
C_USER_AGENT CONSTANT VARCHAR2(4000) := 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)';
BEGIN
-- source: http://awads.net/wp/2005/11/30/http-post-from-inside-oracle/
-- Ask UTL_HTTP not to raise an exception for 4xx and 5xx status codes,
-- rather than just returning the text of the error page.
utl_http.set_response_error_check(false);
-- Begin the post request
l_http_req := utl_http.begin_request (p_url, 'POST', utl_http.HTTP_VERSION_1_1);
-- Set the HTTP request headers
utl_http.set_header(l_http_req, 'User-Agent', C_USER_AGENT);
utl_http.set_header(l_http_req, 'content-type', 'application/json;charset=UTF-8');
utl_http.set_header(l_http_req, 'content-length', LENGTH(p_message));
-- Write the data to the body of the HTTP request
utl_http.write_text(l_http_req, p_message);
-- Process the request and get the response.
l_http_resp := utl_http.get_response (l_http_req);
dbms_output.put_line ('status code: ' || l_http_resp.status_code);
dbms_output.put_line ('reason phrase: ' || l_http_resp.reason_phrase);
LOOP
EXIT
WHEN l_end_loop;
BEGIN
utl_http.read_line(l_http_resp, l_buffer, true);
IF(l_buffer IS NOT NULL AND (LENGTH(l_buffer)>0)) THEN
l_data := l_data||l_buffer;
END IF;
EXCEPTION
WHEN utl_http.end_of_body THEN
l_end_loop := true;
END;
END LOOP;
dbms_output.put_line(l_data);
p_response:= l_data;
-- Look for client-side error and report it.
IF (l_http_resp.status_code >= 400) AND (l_http_resp.status_code <= 499) THEN
dbms_output.put_line('Check the URL.');
utl_http.end_response(l_http_resp);
-- Look for server-side error and report it.
elsif (l_http_resp.status_code >= 500) AND (l_http_resp.status_code <= 599) THEN
dbms_output.put_line('Check if the Web site is up.');
utl_http.end_response(l_http_resp);
RETURN;
END IF;
utl_http.end_response (l_http_resp);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line (sqlerrm);
raise;
END; and executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
SET serveroutput ON
DECLARE
l_url VARCHAR2(200) :='http://MY_IP:8585/apex/demo';
l_json VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
l_response VARCHAR2(30000);
BEGIN
post( p_url => l_url, p_message =>l_json, p_response => l_response);
END;which resulted in :
anonymous block completed
status code: 200
reason phrase: OK
with data inserted. Setup using 2.0.1
Workspace : wsdemo
RESTful Service Module: demo/
URI Template: test
Method: POST
Source Type: PL/SQLand executing in sqldeveloper 3.2.20.09 when connecting directly to box B as scott:
SET serveroutput ON
DECLARE
l_url VARCHAR2(200) :='http://MY_IP:8585//apex/wsdemo/demo/test';
l_json VARCHAR2(20000) := '{"title":"thetitle","description":"thedescription"}';
l_response VARCHAR2(30000);
BEGIN
post( p_url => l_url, p_message =>l_json, p_response => l_response);
END;which resulted in :
status code: 500
reason phrase: Internal Server Error
Listener's log:
Request Path passes syntax validation
Mapping request to database pool: PoolMap [_poolName=apex, _regex=null, _workspaceIdentifier=WSDEMO, _failed=false, _lastUpdate=1364313600000, _template=/wsdemo/, _type=BASE_PATH]
Applied database connection info
Attempting to process with PL/SQL Gateway
Not processed as PL/SQL Gateway request
Attempting to process as a RESTful Service
demo/test matches: demo/test score: 0
Choosing: oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as current candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true]
Determining if request can be dispatched as a Tenanted RESTful Service
Request path has one path segment, continuing processing
Tenant Principal already established, cannot dispatch
Chose oracle.dbtools.rt.resource.templates.jdbc.JDBCResourceTemplateDispatcher as the final candidate with score: Score [handle=JDBCURITemplate [scopeId=null, templateId=2648625079503782|2797815111031405, uriTemplate=demo/test], score=0, scope=SecurityConfig [constraint=none, realm=NONE, logonConfig=LogonConfig [logonForm=null, logonFailed=null]], originsAllowed=[], corsEnabled=true] for: POST demo/test
demo/test is a public resource
Using generator: oracle.dbtools.rt.plsql.AnonymousBlockGenerator
Performing JDBC request as: SCOTT
Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
INFO: Error occurred during execution of: [CALL, begin
insert into scott.json_demo values(/*in:title*/?,/*in:description*/?);
end;, [title, in, class oracle.dbtools.common.stmt.UnknownParameterType], [description, in, class oracle.dbtools.common.stmt.UnknownParameterType]]with values: [thetitle, thedescription]
Mar 28, 2013 1:29:28 PM oracle.dbtools.common.jdbc.JDBCCallImpl execute
INFO: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-id
java.sql.SQLException: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-id
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:879)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:505)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:223)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:205)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:1043)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3612)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3713)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4755)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1378)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.ucp.jdbc.proxy.StatementProxyFactory.invoke(StatementProxyFactory.java:242)
at oracle.ucp.jdbc.proxy.PreparedStatementProxyFactory.invoke(PreparedStatementProxyFactory.java:124)
at oracle.ucp.jdbc.proxy.CallableStatementProxyFactory.invoke(CallableStatementProxyFactory.java:101)
at $Proxy46.execute(Unknown Source)
at oracle.dbtools.common.jdbc.JDBCCallImpl.execute(JDBCCallImpl.java:44)
at oracle.dbtools.rt.plsql.AnonymousBlockGenerator.generate(AnonymousBlockGenerator.java:176)
at oracle.dbtools.rt.resource.templates.v2.ResourceTemplatesDispatcher$HttpResourceGenerator.response(ResourceTemplatesDispatcher.java:309)
at oracle.dbtools.rt.web.RequestDispatchers.dispatch(RequestDispatchers.java:88)
at oracle.dbtools.rt.web.HttpEndpointBase.restfulServices(HttpEndpointBase.java:412)
at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:162)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.doFilter(ServletAdapter.java:1059)
at com.sun.grizzly.http.servlet.ServletAdapter$FilterChainImpl.invokeFilterChain(ServletAdapter.java:999)
at com.sun.grizzly.http.servlet.ServletAdapter.doService(ServletAdapter.java:434)
at oracle.dbtools.standalone.SecureServletAdapter.doService(SecureServletAdapter.java:65)
at com.sun.grizzly.http.servlet.ServletAdapter.service(ServletAdapter.java:379)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.grizzly.tcp.http11.GrizzlyAdapterChain.service(GrizzlyAdapterChain.java:196)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
Error during evaluation of resource template: ORA-06550: line 1, column 6:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare exit for goto if loop mod null pragma
raise return select update while with <an identifier>
<a double-quoted delimited-identifier> <a bind variable> <<
close current delete fetch lock insert open rollback
savepoint set sql execute commit forall merge pipe
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-idPlease advise.
Regards
ZackZack.L wrote:
Hi Andy,
Sorry, forgot to post the Source that's use by both AL1.1.4 and AL2.0.1.
Source
begin
insert into scott.json_demo values(:title,:description);
end;
it's failing during the insert?
Yes, it failed during insert using AL2.0.1.
So the above statement produces the following error message:
The symbol "" was ignored.
ORA-06550: line 2, column 74:
PLS-00103: Encountered the symbol "" when expecting one of the following:
begin case declare end exception exit for goto if loop mod
null pragma raise return select update while with
<an identifier> <a double-quoted delimited-idThis suggests to me that an unprintable character (notice how there is nothing between the double quotes - "") has worked its way into your PL/SQL Handler. Note how the error is reported to be a column 74 on line 2, yet line 2 of the above block should only have 58 characters, so at a pure guess somehow there's extra whitespace on line 2, that is confusing the PL/SQL compiler, I suggest re-typing the PL/SQL handler manually and seeing if that cures the problem. -
Need Help in Splitting a String Using SQL QUERY
Hi,
I need help in splitting a string using a SQL Query:
String IS:
AFTER PAINT.ACOUSTICAL.1..9'' MEMBRAIN'I would like to seperate this string into multiple lines using the delimeter .(dot)
Sample Output should look like:
SNO STRING
1 AFTER PAINT
2 ACOUSTICAL
3 1
4
5 9" MEMBRAIN
{code}
FYI i am using Oracle 9.2There's this as well:
with x as ( --generating sample data:
select 'AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN' str from dual union all
select 'BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN' str from dual)
select str,
row_number() over (partition by str order by rownum) s_no,
cast(dbms_xmlgen.convert(t.column_value.extract('//text()').getstringval(),1) as varchar2(100)) res
from x,
table(xmlsequence(xmltype('<x><x>' || replace(str,'.','</x><x>') || '</x></x>').extract('//x/*'))) t;
STR S_NO RES
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 1 AFTER PAINT
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 2 ACOUSTICAL
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 3 1
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 4
AFTER PAINT.ACOUSTICAL.1..9" MEMBRAIN 5 9" MEMBRAIN
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 1 BEFORE PAINT
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 2 ELECTRIC
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 3 2
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 4
BEFORE PAINT.ELECTRIC.2..45 caliber MEMBRAIN 5 45 caliber MEMBRAIN
{code} -
Help please !! Need to insert date automatically in form
I have been trying unsuccessfully for a week to automatically
capture today's date on a form. I can display a date on screen but
it will not insert date into mySQL db. All other information is
inserted as expected.
Am I just whistling in dark? Is there no way to eliminate
user input for the order date field?
I have looked throughout the forums and no luck.
Anyone have any ideas about how to do?
Thanks,
Dale :-)You can use a timestamp function within your MySQL table, but
remember you can only use the timestamp function ONCE in a table.
Using the timestamp Function:
Set the field type to TIMESTAMP. You can also set the default
to CURRENT_TIMESTAMP and the attributes to ON UPDATE
CURRENT_TIMESTAMP if you want the timestamp to change when the
record is updated.
If you want to record times more than the one time you are
using the timestamp and you are using PHP/MySQL or PHP/MySQL ADODB
(InterAKT's PhAKT Extension), then try this:
http://chuckomalley.net/help/insert_date_help.php
That gets the time into the MySQL Database. Next thing you'll
want to do is to have it display the time the way you want it. The
default will display it as yyyy-mm-dd hh:mm:ss and you may not want
it that way. To display it the way you want it try this:
http://chuckomalley.net/help/display_formatted_date.php
For the specific syntax on using this, refer to the online
MySQL Manual and search for DATE_FORMAT() at
http://dev.mysql.com/doc/mysql/en/index.html
Cheers
Chuck -
Help need on inserting system date on database
hello every body,
I need to insert system date into database through prepared statement.
i wrote code :
java.util.Date d=new java.util.Date();
Preparestatement psmt;
psmt.setDate(8, java.sql.Date(d));
am getting class cast exception :
could u please tell me how to insert system date through prepared statement..
thanks in advance..Surround your code with a
try{
//Insert date here
catch(Exception e){
//handle exceptions here
e.printStackTrace();
Who says he didn't already?
Try this:
java.util.Date d=new java.util.Date();
>
Preparestatement psmt;
psmt.setDate(8, new
java.sql.Date(d.getTime()));This is correct, but can be condensed (if you want)
psmt.setDate(8, new java.sql.Date(new java.util.Date().getTime()));
>
It's good idea to use the JDBC escape function
instead of using a specific DBMS function. This way,
your code will be portable.
sql = "INSERT INTO USERS VALUES("
+ "'" + userName + "'" + ","
+ "'" + userPw + "'" + ","
+ " {fn now() } )"; e Real's How To
(http://64.18.163.122/rgagnon/javadetails/java-0567.ht
ml)
And this is only marginally applicable. If he wishes to use the same statement for the current date, as well as other dates, he cannot make use of this. Of course, I don't really know if I would trust or recommend a tutorial site that advocates building statements that are screaming for injection attack attempts.
Edit: Too slow by a mile! -
Help needed in SQL performance - Using CASE in SQL statement versus 2 query
Hi,
I have a requirement to find count from a bunch of tables.
The SQL I have gives the count of all members.
I have created 2 queries to find count of active and inactive members.
The key difference is only the active dates.
Each query takes 20 seconds to execute.
I modified the SQL to use CASE statement in the SELECT.
So after the data is fetched the CASE statement will evaluate the active date and gives 2 counts (active and inactive)
Is it advisable to use this approach. Will CASE improve SQL performance ? I have to justify this.
Please let me know your thoughts.
Thanks,
JHi,
If it can be done in single SQL do it in single SQL.
You said:
Will CASE improve SQL performance There can be both cases to prove if the performance is better or worse.
In your case you should tell us how it is.
Regards,
Bhushan -
Insert data using peoplesoft webservice gives component API error
Hi,
I am using jdeveloper 11g to consume a peoplesoft webservice using the wsdl file and JAX-Ws approach to build the proxy.
I have been successfull in getting to work the "get", "find" methods for the webservice but while trying to access the create/Update(inserting data) method, it gives me the following exception.
In CREATE method
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Component Interface API.
at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:197)
at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:130)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:125)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:95)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:135)
at $Proxy32.createCompIntfcKCMWEBCASECI(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.wsee.jaxws.spi.ClientInstance$ClientInstanceInvocationHandler.invoke(ClientInstance.java:363)
at $Proxy33.createCompIntfcKCMWEBCASECI(Unknown Source)
at project1.proxy.KCM_WEB_CASE_CISoapClient.createKCMMethod(KCM_WEB_CASE_CISoapClient.java:318)
at project1.proxy.KCM_WEB_CASE_CISoapClient.main(KCM_WEB_CASE_CISoapClient.java:116)
Process exited with exit code 1.
From the exception it is not clear what is missing or where am i going wrong. I have provided all the mandatory values required by the method.
The create method generated needs almost 40 parameters, hence i am intializing all of them and sending it.
Few parameters are INOUT or out mode, depending on that i even created the required holder etc.
I dont have any access to peoplesoft logs, is there a way to debug this further.
Basically i am stuck here as i am not able to decode this exception.
Can anyone tell me where is it failing, is it a some formation error or is it creating a query at db and getting a sql error??
as mentioned earlier, its very difficult to get access to db resources hence its becmong very difficult to debug the error.
Any help will be appreciated.
Thank you in advance
Ashvini
Edited by: [email protected] on Jun 7, 2010 7:49 AM
Edited by: [email protected] on Jun 8, 2010 6:37 AMHi, I have exact the same problem. Have you got any answer for this problem yet? Please forward it to me if you have one. Many thanks.
-
Failing to import data using SQL query
I am trying to import data from a sql query to analysis service in SSDT. i went to model > import from data source >Microsoft SQL Server and i chose from query. I typed my query which works fin in SSMS and when i press import if gives me a error. what
is going on please help here is the error
DirectQuery error: All tables used when querying in DirectQuery Mode must be from a single relational Data Source.
here is my query:
USE AdventureWorks2012;
SELECT SalesPersonID, [29484] Brian, [29485] Peter, [29486] Frank, [29518] Sarah, [29519] Janet, [29520] Alice, [29608] Martin, [29609] Patrick, [29610] Wasu, [29780] Samanyika, [29781] Vladmire
FROM
SELECT SalesOrderID, SalesPersonID, CustomerID
FROM Sales.SalesOrderHeader
WHERE SalesPersonID IS NOT NULL
As P PIVOT
COUNT (SalesOrderID) FOR CustomerID IN ([29484], [29485], [29486], [29518], [29519], [29520], [29608], [29609], [29610], [29780], [29781])
AS PVT
ORDER BY SalesPersonID ASC;Hi,
When importing data from relational data source, the steps are:
In SQL Server Data Tools (SSDT), click the Model menu, and then click Import
from Data Source.
On the Connect to a Data Source page, select the type of database to connect to, and then click Next.
Follow the steps in the Table Import Wizard. On subsequent pages, you will be able to select specific tables and views or apply filters by using the Select
Tables and Views page or by creating a SQL query on Specify a SQL Query page.
As we can see on the steps, we need to select one database, so we needn't to write "USE AdventureWorks2012" on the query.
Reference:Import from a Relational Data Source
Regards,
Charlie Liao
TechNet Community Support -
Insert data using row selector
Hi :
In my applicaion i need to insert only the selected data ie row
the query i am using is
select
html_db_item.text(1,pobj.name,20,25) "object Name",
html_db_item.text(1,null,20,25) "Incomming Hours ",
html_db_item.text(1,null,20,25) "Design Hours "
from projects pro.
project_objects pobj
where pro.id = pobj.pro_id and
pro.id = :p10_projects
here p10_projects is the project where for each project there would be 10 to 100 objects ie pobj.name
here i need to insert these object names and hours into anothere table where i need a row selector to select only selected objects and insert please suggest me
so as i select the rows only that need to be inserted
Thanks
SudhirRandy :
please try this query
SELECT
HTMLDB_ITEM.DISPLAY_AND_SAVE(2,NULL) "Project Objects",
HTMLDB_ITEM.DATE_POPUP(3,rownum,null,'dd-mon-yyyy',12,15) "date"
FROM
DUAL
UNION
SELECT
HTMLDB_ITEM.DISPLAY_AND_SAVE(2,SYSDATE) "Project Objects",
HTMLDB_ITEM.DATE_POPUP(3,rownum,null,'dd-mon-yyyy',12,15) "date"
FROM
DUAL
first change the query to sql updatable form and then add row selector to this report and try to select the 2nd row date picker ull find the problem wht i am facing
i need row selector becouse to select the date indivisually and insert them
please give me some soloution
thanks
sudhir
Maybe you are looking for
-
10.5.6 update is installing updates in Previous System/Applications folder.
After updating from OS X 10.5.5 to 10.5.6 I discovered several of the updates were installed into Previous System/Applications rather than the Macintosh HD/Applications folder. This resulted in Mail (3.1 build 914/933) quitting repeatedly which is wh
-
Can't get LR3 to import photos from one external hard drive to another?
I'm wanting to move thousands of raw photos from a folder in one external hard drive to another folder in a different external hard drive so all my photos are in one photo folder instead of two. I've gone through the importing routine inside of ligh
-
Transferring applications to external hard drive
I have a macbook and my startup disk was full because of so many photos and videos. So I purchased an external hardrive in order to load those items onto it. I thought I had done it right, but when I go to add more items to my itunes or iphoto (both
-
Cant view heatmaps in adobe acrobat pro XI Mac
Using AAP xi on a mac. I create a few moderately high density heatmaps in R that display w/o a problem with Mac "preview" but will not render (are not visible) in AAP xi. Can anyone tell me what the problems is?
-
ITunes (11.1.5.) doesn't work properly in Win 7
Am I the only one whose iTunes doesn't work properly in Win 7? I open iTunes and few seconds later it closes itself because Windows finds some problems. I've already reinstalled the whole program but this problem still stands.