JDBC DATE set to null?
Hello,
how do I update an existing DATE (e.g: 2003.01.03 00:00:00) to NULL in JDBC?
my code:
String sqlStatement = "UPDATE SET DATE = getPersonDate FROM PERSONS WHERE PERSONNUMBER = "+ getPersonNumber();
DBLayer.execute(sqlStatement);
Here it should be possible to set an existing date in the DB to NULL. How could I do this?
Please help!
String sqlStatement = "UPDATE SET DATE = NULL " +
" FROM PERSONS WHERE PERSONNUMBER = " + getPersonNumber();HTH
Walk Good
Similar Messages
-
How to set JDBC Data Sources in Oracle MapViewer for Oracle database 12c Release 1 (12.1.0.1)?
The following is my configuration in the conf\mapViewerConfig.xml:
<map_data_source name="mvdemo12"
jdbc_host="127.0.0.1"
jdbc_sid="orcl12c1"
jdbc_port="1522"
jdbc_user="mvdemo"
jdbc_password="7OVl2rJ+hOYxG5T3vKJQb+hW4NPgy9EN"
jdbc_mode="thin"
number_of_mappers="3"
allow_jdbc_theme_based_foi="true"
editable="true"/>
<!-- **** -->
But it does not work.
After use "sqlplus mvdemo/[email protected]:1522/pdborcl", it connected to the Oracle database 12c.
Does anyone know it?
Thanks,For 11.1.1.7.1 use the syntax for jdbc_sid, i.e.
//mypdb1.foo.com as described in the README,
- MapViewer native (non-container) data sources can now use database service name in place of SID. To supply a db service name, you will use the same jdbc_sid attribute, but specify the service name with double slashes in front, such as follows:
<map_data_source name="myds"
jdbc_host="foo.com"
jdbc_sid="//mypdb1.foo.com"
jdbc_port="1522"
/>
For 11.1.1.7.0 use a container_ds instead.
i.e. instead of using
<map_data_source name="my_12c_test"
jdbc_host="mydbinstance"
jdbc_sid="pdborcl12c"
jdbc_port="1522"
jdbc_user="mytestuser"
jdbc_password="m2E7T48U3LfRjKwR0YFETQcjNb4gCMLG8/X0KWjO00Q="
jdbc_mode="thin"
number_of_mappers="6"
allow_jdbc_theme_based_foi="false"
editable="false"
/>
use
<map_data_source name="my_12c_test"
container_ds="jdbc/db12c"
number_of_mappers="6"
allow_jdbc_theme_based_foi="false"
editable="false"
/>
In my case the Glassfish 3.1.2.2 JDBC connection pool definition was
Property
url jdbc:oracle:thin:@mydbinstance:1522/pdborcl12c.rest_of.service.name
Uncheck the Wrap JDBC Objects option in Advanced panel, i.e. the Edit JDBC Connection Pool Advanced properties page.
Add a JDBC resource for that newly created pool
Use that in mapviewerconfig.xml as above -
Set oracle.jbo.domain.Date object to null
Hi
We have a case where we need to set a Date value to null.
We have tried row.setCxdDate(null) and row.setCxdDate(new Date("")), but to no avail.
When we call DBTransaction.commit() in the application module, all the other changes are persisted to the database, except for the date. No exceptions are generated at all.
I have searched through these forums, and the only thing I have come up with, was that this was filed as a bug to be fixed in the 9.0.3 release; we are using 10.1.2!
Does anyone know how to solve this?
TIA
GarethIt returned "1970-01-01"
By the way I found that there is one method getTime() in oracle.jbo.domain.Date class
http://otndnld.oracle.co.jp/document/products/as10g/101300/B25221_03/web.1013/b16007/oracle/jbo/domain/Date.html used in 10.3
But could not find it while using in JDeveloper 11.1.1.3 <http://download.oracle.com/docs/cd/E17904_01/apirefs.1111/e10653/oracle/jbo/domain/Date.html>
Edited by: Moinak on Mar 4, 2011 7:08 AM
Edited by: Moinak on Mar 4, 2011 7:10 AM -
Using WLST to set up credential mapping on JDBC Data Source
I am wanting to write a script (WLST) to set up a large initial set of credential mappings on a JDBC data source.
I can create the datasource and do all the basic set ups, but I can't figure out how to do the credential mappings.
I tried the "record" option from the Admin console, but it created a script that says that credential mappings are not recorded.
This is the mapping function that you get to from the "Security" tab on the DataSource page, and then the "Credential Mappings" tab. This allows you to map a "WLS user" to a "remote user" - which in my case is an Oracle OLS user.
I am using Weblogic 10.3
Can anyone point me to a set of commands which can perform this function?
Thanks!I wonder if there isn't a publicly visible MBean for the credential mapping. That would explain why the recorded script doesn't have the mbean method invocations.
-
Setting up JDBC Data Source for JCA Database Adapter in WLS - only SID?
Following the documentation for setting up a connection for use with the JCA Database Adapter (http://otnbeta.oracle.com/fmw11g/582tj30eapvb/integration.1111/e10231/life_cycle.htm), section 2.4.1, Step 8 simply says "Enter the connection properties in the Connection Properties page, and then click Next"
In the "Create a New JDBC Data Source" screen of the WLS Administration Console there is the entry field vaguely labeled as "Database Name:" Of course I entered the Oracle RDBMS service name (which we should ALWAYS be using), only to be informed upon clicking next, that WLS was expecting the SID.
Two things:
1. At least through this maintenance console, it appears that BEA did not understand the whole concept or value of Oracle RDBMS logical service names versus the SID (I have seen this in several products that Oracle has acquired). Best practice would be to use the Oracle RDBMS service name, which doesn't appear to be an option in this console.
2. The OFM documentation should be more helpful in explaining.Compare to the analogous setup in OAS 10.1.3.4/EM... far better clarity in the maintenance console and option of either SID or service name.
-
Displaying data from one data set when a field is null in other data set
Hi All,
I have a report where I need to show some columns from one data set(Ex: SsOpportunity) ....... when there is no data in a column (Ex: "Petrofac-ProductLine") in other data set (Ex: SsRevenue) in one table. I have another table which shows data from SsRevenue when there some data in "Petrofac-ProductLine" column.
The first table is not working for me. Kindly suggest me where to specify the condition.
Thanks in advance,
Imtiaz.Will it be possible for you to send me a sample xml and RTF?
-
Using DAO using a JDBC data source with struts
Hello,
I have created a number of Data Access Objects and Transfer Objects to use in a non EJB, struts web application I am developing. I had tested these with a kind of a Service Locator custom class to provide access to a JDBC connection. My custom class is a bit clunky and not very configurable. I would like to use a data source using the struts config XML file e.g.
<data-sources>
<!-- configuration for commons BasicDataSource -->
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property
property="description"
value="My MySQL Database Connection" />
<set-property
property="driverClassName"
value="com.mysql.jdbc.Driver" />
<set-property
property="url"
value="jdbc:mysql://localhost/databaseName" />
<set-property
property="username"
value="myUsername" />
<set-property
property="password"
value="xxxxxxxxx" />
<set-property
property="maxActive"
value="10" />
<set-property
property="maxWait"
value="5000" />
<set-property
property="defaultAutoCommit"
value="false" />
<set-property
property="defaultReadOnly"
value="false" />
</data-source>
</data-sources>This is great, and precisely the kind of thing I would like to use. However, this datasource is only available AFAIK through a HttpServletRequest instance like in the example I found below...
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception
javax.sql.DataSource dataSource = null;
java.sql.Connection myConnection = null;
try {
dataSource = getDataSource(request);
myConnection = dataSource.getConnection();
// do what you wish with myConnection
} catch (SQLException sqle) {
getServlet().log("Connection.process", sqle);
} finally {
//enclose this in a finally block to make
//sure the connection is closed
try {
if(myConnection != null)
myConnection.close();
} catch (SQLException e) {
getServlet().log("Connection.close", e);
return (mapping.findForward("success"));
}That would be great if I wanted to use the database connection anywhere near a struts Action (wrong tier!). I want access like that to to a data source in my DAOs. Is it possible for me to use the data-sources aproach to access the DB from my DAOs or will I need to use something like JNDI to do this in a similar way but separate from struts. If so I have a big gap in my knowledge as far as JNDI goes which I need to fill and that will be my next question
I'm relatively new to using patterns inn Java and any help or pointers would be great.
Thanks :)Create a JAAS Authentication Entry in the Server configuration.
This should then appear in the drop-down when specifying your DataSource. -
SQL Update a Single Row Multiple Times Using 2 Data Sets
I'm working in tsql and have an issue where I need to do multiple updates to a single row based on multiple conditions.
By Rank_
If the column is NULL I need it to update no matter what the Rank is.
If the Ranks are the same I need it to update in order of T2_ID.
And I need it to use the last updated output.
I've tried using the update statement below but it only does the first update and the rest are ignored. Here is an example of the data sets i'm working w/ and the Desired results. Thanks in advance!
update a
set Middle = case when a.Rank_> b.Rank_ OR a.Middle IS NULL then ISNULL(b.Middle,a.Middle) end,
LName = case when a.Rank_> b.Rank_ OR a.Lname IS NULL then ISNULL(b.LName,a.LName) end,
Rank_ = case when a.Rank_> b.Rank_ then b.Rank_ end
from #temp1 a
inner join #temp2 b on a.fname = b.fname
where b.T2_ID in (select top 100% T2_ID from #temp2 order by T2_ID asc)The Merge clause actually errors because it attempt to update the same record. I think this CTE statement is the closest I've come but I'm still working through it as I'm not too familiar w/ them. It returns multiple rows which I will have to
insert into a temp table to update since the resulting row I need is the last in the table.
;WITH cteRowNumber
AS(
Select DISTINCT
Row_Number() OVER(PARTITION BY a.LName ORDER BY a.LName ASC, a.Rank_ DESC,b.T2ID ASC) AS RowNumber
,a.FName
,a.LName
,b.LName as xLname
,a.MName
,b.MName AS xMName
,a.Rank_
,b.Rank_ AS xRank
,b.T2ID
FROM #temp1 a
inner join #temp2 b
ON a.fname = b.fname
), cteCursor
AS(
Select a.RowNumber,
a.Fname
,a.LName
,a.xLname
,a.MName
,a.xMName
,a.xRank
,a.T2ID
,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xRank,a.Rank_) else ISNULL(a.Rank_,a.xRank) end AS Alt_Rank_
,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xMName,a.MName) else ISNULL(a.MName,a.xMName) end AS Alt_MName
,CASE WHEN a.Rank_ >= a.xRank THEN ISNULL(a.xLName,a.lname) else ISNULL(a.LName,a.xlname) end as Alt_Lname
FROM cteRowNumber a
where a.RowNumber = 1
UNION ALL
Select crt.RowNumber
,crt.FName
,crt.LName
,crt.xLname
,crt.MName
,crt.xMName
,crt.xRank
,crt.T2ID
,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xRank,Prev.Alt_Rank_) else ISNULL(Prev.Alt_Rank_,crt.xRank) end AS Alt_Rank
,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xMName,Prev.Alt_MName) else ISNULL(Prev.Alt_MName,crt.xMName) end AS Alt_MName
,CASE WHEN Prev.Alt_Rank_ >= crt.xRank THEN ISNULL(crt.xLName,Prev.Alt_Lname) else ISNULL(Prev.Alt_Lname,crt.xLName) end as Alt_Lname
FROM cteCursor prev
inner join cteRowNumber crt
on prev.fname = crt.fname and prev.RowNumber + 1 = crt.RowNumber
SELECT cte.*
FROM cteCursor cte -
How do I select one record when working with image data sets?
David Powers had an example with creating spry data sets and using the filename in the database linked to images in the local files as data sources. The pages shows the images with the specified information requested, however all of the images display with their content. I want to pull an individual record with the image and content. HELP!
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
return $theValue;
$maxRows_rs_getPhoto = 10;
$pageNum_rs_getPhoto = 0;
if (isset($_GET['pageNum_rs_getPhoto'])) {
$pageNum_rs_getPhoto = $_GET['pageNum_rs_getPhoto'];
$startRow_rs_getPhoto = $pageNum_rs_getPhoto * $maxRows_rs_getPhoto;
mysql_select_db($database_gepps1_db, $gepps1_db);
$query_rs_getPhoto = "SELECT last_name, first_name, personal_bio, file_name, width, height FROM mem_profile";
$query_limit_rs_getPhoto = sprintf("%s LIMIT %d, %d", $query_rs_getPhoto, $startRow_rs_getPhoto, $maxRows_rs_getPhoto);
$rs_getPhoto = mysql_query($query_limit_rs_getPhoto, $gepps1_db) or die(mysql_error());
$row_rs_getPhoto = mysql_fetch_assoc($rs_getPhoto);
if (isset($_GET['totalRows_rs_getPhoto'])) {
$totalRows_rs_getPhoto = $_GET['totalRows_rs_getPhoto'];
} else {
$all_rs_getPhoto = mysql_query($query_rs_getPhoto);
$totalRows_rs_getPhoto = mysql_num_rows($all_rs_getPhoto);
$totalPages_rs_getPhoto = ceil($totalRows_rs_getPhoto/$maxRows_rs_getPhoto)-1;
?>
<table width="800" border=" ">
<tr>
<td>Image</td>
<td>thumbnail</td>
<td>firstname</td>
<td>lastname</td>
<td>personal bio</td>
</tr>
<?php do { ?>
<tr>
<td><img src="<?php echo $row_rs_getPhoto['file_name']; ?>" alt="" width="<?php echo $row_rs_getPhoto['width']; ?>" height="<?php echo $row_rs_getPhoto['height']; ?>"></td>
<td><img src="<?php echo $row_rs_getPhoto['file_name']; ?>" alt="" width="50" height="35"></td>
<td><?php echo $row_rs_getPhoto['first_name']; ?></td>
<td><?php echo $row_rs_getPhoto['last_name']; ?></td>
<td><?php echo $row_rs_getPhoto['personal_bio']; ?></td>
</tr>
<?php } while ($row_rs_getPhoto = mysql_fetch_assoc($rs_getPhoto)); ?>
</table>
<?php
mysql_free_result($rs_getPhoto);
?>I tried pulling the record by using entered value, but then I would need to create several recordsets.
It's actually no problem doing that. Can you explain more what you want the final result of this page to display? You are pulling a recordset of the entire group of photos. Do you still want that comprehensive recordset on this page? How many other images do you want? Are you trying to make a master/detail pair where this page displays only the details for a single image? See what I mean? -
Error in setting a NULL !
I am trying to set a NULL in a int column. The column allows nulls and has a foreign key.
I tried cs.setNull(16,Types.INTEGER), still get this error:
[IBM][SQLServer JDBC Driver][SQLServer]UPDATE statement conflicted with COLUMN FOREIGN KEY constraint.
I get another error from Websphere :
Shareable connection MCWrapper id 2c3c42f1 Managed connection com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl@2bc0c2f1 State:STATE_TRAN_WRAPPER_INUSE from resource jdbc/ds was used within a local transaction containment boundary.
Any ideeas on how I can get around the foreign key constraint an set a NULL??
Thanks,
mihut_mI was too close to the monitor, couldn't see the big picture ! :-) Now it works.
Although, I still get that Websphere error:
7c7fc721 SharedPool I J2CA0086W: Shareable connection MCWrapper id 31c73d Managed connection comm.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl@2e55c73d State:STATE_TRAN_WRAPPER_INUSE from resource jdbc/ds was used within a local transaction containment boundary.
It use to work fine, no errors.
Any ideeas??
mihut -
Procedure to take inpot data set and return result set
Hi all,
I have a situation where there will be one "standard" set of data (source_data below) and I will need to get information on results for certain groups of clients (client_data being an example). As straight SQL this would be very easy (see below) -- real world problem is a little more complicated. However, what I would like to do is set up a procedure so that I can pass it my variable client data and it will spit back out a data set the same as the output from the given SQL.
A pointer in the right direction would be appreciated. If I could "pass the client data" as a string containing a SQL query, that would be even better, e.g.
GetResults('select client_id,min(whatever_date) from some_client_data where .....',MyOutputRefCursor?)
create table source_data
(client_id integer,
tdate date,
amount number(6,2));
create table client_data
(client_id integer,
critical_date date);
insert into source_data values(1,to_date('20090104','yyyymmdd'),1000);
insert into source_data values(1,to_date('20100104','yyyymmdd'),2000);
insert into source_data values(1,to_date('20110104','yyyymmdd'),3000);
insert into source_data values(1,to_date('20120104','yyyymmdd'),4000);
insert into source_data values(2,to_date('20090104','yyyymmdd'),5000);
insert into source_data values(2,to_date('20090604','yyyymmdd'),1000);
insert into source_data values(2,to_date('20100104','yyyymmdd'),2000);
insert into source_data values(3,to_date('20091004','yyyymmdd'),3000);
insert into source_data values(3,to_date('20091104','yyyymmdd'),4000);
insert into source_data values(4,to_date('20090104','yyyymmdd'),5000);
insert into source_data values(4,to_date('20090604','yyyymmdd'),2000);
insert into client_data values(1,to_date('20110104','yyyymmdd'));
insert into client_data values(2,to_date('20090604','yyyymmdd'));
select c.client_id,
sum(CASE WHEN tdate < critical_date then amount else null end) used_before,
sum(CASE WHEN tdate >= critical_date then amount else null end) used_after
from source_data s
inner join client_data c on s.client_id = c.client_id
GROUP BY c.client_id;Thanks,
JonJonWat wrote:
I have a situation where there will be one "standard" set of data (source_data below) and I will need to get information on results for certain groups of clients > (client_data being an example). As straight SQL this would be very easy (see below) -- real world problem is a little more complicated. Can you give a more accurate representation of the real world problem?
A pointer in the right direction would be appreciated. If I could "pass the client data" as a string containing a SQL query, that would be even better, e.g.Passing a query as as string for execution is rarely the correct approach. This approach won't scale and most likely will result in maintenance and security problems.
If you can update your post to have a more accurate representation of the problem you are trying to solve you'll probably get an acceptable answer. Other than that all I can suggest is that you need to rethink the approach a bit. For example, if you know you need to filter out a set of data to join to your SOURCE_DATA table, why couldn't you do that inside the procedure?
SELECT c.client_id
, SUM
( CASE
WHEN tdate < critical_date
THEN amount
END
) AS used_before
, SUM
( CASE
WHEN tdate >= critical_date
THEN amount
END
) AS used_after
FROM source_data s
JOIN ( SELECT client_id
, MIN(<date column>) AS critical_date
FROM client_data
WHERE <where clause>
GROUP BY client_id
) c on s.client_id = c.client_id
GROUP BY c.client_id; -
Duplicating Data Sets depending on input parameters
I originally posted this question as part of Oracle Reports but I think its not really an Oracle Report issue, its more an SQL Issue. I am on Oracle 9i.
I need to generate a Report that is based on a maximum of 6 input parameters.
Three of them belong to Customer ID# and 3 belong to Number of Copies that need to be printed on the Report.
Parameters for Customers: P_CUST_ID1, P_CUST_ID2, P_CUST_ID3
Parameters for the Number of Copies: P_N1, P_N2, P_N3
So, at any given point, there could be a maximum of 3 Customer ID's passed to the main query. Here is an example of what the input parameters could look like.
User chose to enter values for Customer ID's 1 and 2 and left it blank for Customer 3.
Customer ID1 1001 Number of Copies 2
Customer ID2 1002 Number of Copies 3
Customer ID3 ---- Number of Copies -The Query that retrieves data looks something like this. The query below is intended to fetch Customer Home and Office Addresses.
Of course, it is possible that there might be No home or Office Address or both.
SELECT c.cust_no,
c.saln||c.first_name||' '||c.last_name cust_name,
a.address_type,
a.street,
a.city||' '||a.province||' '||a.postal_code city,
'('||a.tel_area||') '||a.tel_number telephone
FROM customer c, customer_address a
WHERE c.cust_no = a.cust_no
AND c.cust_no IN (:P_CUST_ID1, :P_CUST_ID2, :P_CUST_ID3);Based on my query:
Customer ID 1001 has 3 Addresses (2 Home and 1 Office) --> Total number of Records = 3
Customer ID 1002 has 2 Addresses (1 Home and 1 Office) --> Total number of Records = 2
The output should be something like this. I have put a Label Copy1, Copy2 and Copy3 to show
how the data will appear for readability.
Cust No Customer Name Address Type Address Line 1 Address Line 2 Telephone
Copy1
1001 Mr Robert Green H 2100 Picket Fences Vancouver BC V6E 2C9 (604)726-5555
1001 Mr Robert Green H 2300 Happy Valley Vancouver BC V6G 2N8 (604)308-5555
1001 Mr Robert Green O 1200 Davie Street Vancouver BC V1V 1X1 (604)211-5555
Copy2
1001 Mr Robert Green H 2100 Picket Fences Vancouver BC V6E 2C9 (604)726-5555
1001 Mr Robert Green H 2300 Happy Valley Vancouver BC V6G 2N8 (604)308-5555
1001 Mr Robert Green O 1200 Davie Street Vancouver BC V1V 1X1 (604)211-5555
Copy1
1002 Ms Cynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416)432-5555
1002 Ms Cynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416)321-5555
Copy2
1002 Ms Cynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416)432-5555
1002 Ms Cynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416)321-5555
Copy3
1002 Ms Cynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416)432-5555
1002 Ms Cynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416)321-5555Scripts for the table creation and INSERTs
CREATE TABLE CUSTOMER
"CUST_NO" VARCHAR2(4 BYTE) NOT NULL,
"SALN" VARCHAR2(4 BYTE),
"FIRST_NAME" VARCHAR2(20 BYTE),
"LAST_NAME" VARCHAR2(20 BYTE),
CONSTRAINT "CUSTOMER_PK" PRIMARY KEY ("CUST_NO")
Insert into CUSTOMER values ('1001','Mr','Robert','Green');
Insert into CUSTOMER values ('1002','Ms','Cynthia','Brown');
Insert into CUSTOMER values ('1003','Dr','David','Taylor');
CREATE TABLE CUSTOMER_ADDRESS
"CUST_NO" VARCHAR2(4 BYTE) NOT NULL ENABLE,
"ADDRESS_TYPE" VARCHAR2(1 BYTE) NOT NULL ENABLE,
"STREET" VARCHAR2(20 BYTE),
"CITY" VARCHAR2(20 BYTE),
"PROVINCE" VARCHAR2(2 BYTE),
"POSTAL_CODE" VARCHAR2(10 BYTE),
"TEL_AREA" VARCHAR2(3 BYTE),
"TEL_NUMBER" VARCHAR2(10 BYTE)
Insert into CUSTOMER_ADDRESS values ('1001','H','2100 Picket Fences','Vancouver','BC','V6E 2C9','604','726-5555');
Insert into CUSTOMER_ADDRESS values ('1001','H','2300 Happy Valley','Vancouver','BC','V6G 2N8','604','308-5555');
Insert into CUSTOMER_ADDRESS values ('1001','O','1200 Davie Street','Vancouver','BC','V1V 1X1','604','211-5555');
Insert into CUSTOMER_ADDRESS values ('1002','H','261 King Street W','Calgary','AB','M5A 1N1','416','432-5555');
Insert into CUSTOMER_ADDRESS values ('1002','O','150 Bloor St W','Calgary','AB','M1W 1S3','416','321-5555');
Insert into CUSTOMER_ADDRESS values ('1003','O','435 Richmond Street','Calgary','AB','M5A 4T6','416','453-5555');Any help or pointers in this regard would be great.
I could have adopted a procedure to use Temporary tables but I really would prefer not going in that direction as there could be quite a few reports that need to be generated in this manner.
Thanks and have a great weekend.Hi,
Roxyrollers wrote:
Hi Frank,
Here is my piece of code that I was working on Friday... Okay, but what's wrong with the solution I posted on Saturday?
WITH report_parameters AS
SELECT :p_cust_no_1 AS cust_no, :p_no_copies_1 AS no_copies FROM dual UNION ALL
SELECT :p_cust_no_2 AS cust_no, :p_no_copies_2 AS no_copies FROM dual UNION ALL
SELECT :p_cust_no_3 AS cust_no, :p_no_copies_3 AS no_copies FROM dual
, cntr AS
SELECT LEVEL AS n
FROM (
SELECT MAX (no_copies) AS max_no_copies
FROM report_parameters
CONNECT BY LEVEL <= max_no_copies
SELECT c.cust_no,
c.saln||c.first_name||' '||c.last_name cust_name,
a.address_type,
a.street,
a.city||' '||a.province||' '||a.postal_code city,
'('||a.tel_area||') '||a.tel_number telephone
, t.n -- If wanted
FROM customer c
, customer_address a
, report_parameters p
, cntr t
WHERE c.cust_no = a.cust_no
AND c.cust_no = p.cust_no
AND p.no_copies >= t.n
ORDER BY c.cust_no
, t.n
, a.address_type
;Output, given your sample data and parameters:
CUST CUST_NAME A STREET CITY TELEPHONE N
1001 MrRobert Green H 2100 Picket Fences Vancouver BC V6E 2C9 (604) 726-5555 1
1001 MrRobert Green H 2300 Happy Valley Vancouver BC V6G 2N8 (604) 308-5555 1
1001 MrRobert Green O 1200 Davie Street Vancouver BC V1V 1X1 (604) 211-5555 1
1001 MrRobert Green H 2100 Picket Fences Vancouver BC V6E 2C9 (604) 726-5555 2
1001 MrRobert Green H 2300 Happy Valley Vancouver BC V6G 2N8 (604) 308-5555 2
1001 MrRobert Green O 1200 Davie Street Vancouver BC V1V 1X1 (604) 211-5555 2
1002 MsCynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416) 432-5555 1
1002 MsCynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416) 321-5555 1
1002 MsCynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416) 432-5555 2
1002 MsCynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416) 321-5555 2
1002 MsCynthia Brown H 261 King Street W Calgary AB M5A 1N1 (416) 432-5555 3
1002 MsCynthia Brown O 150 Bloor St W Calgary AB M1W 1S3 (416) 321-5555 3 WITH DOES work in Oracle 9.1, and higher. Are you getting an error message that starts with "SP"? Those are SQL*Plus errors, that occur before your code is even sent to the database. In extremely old versions of SQL*Plus, a statement cannont begin with the keyword WITH. The best solution is to upgrade SQL*Plus, but you could also re-wqrite the query so WITH is not the first word of the statement. In this case, you could also use in-line views instead of WITH.
I tried to generate duplicate data sets as a Sub-Query like RP suggested and it seems to be working except the ordering seems to be messed up for Mr Robert Green. The correct order should have been Home, Home, Office and then Home, Home, Office again...The order above seems to be what you want, but there are many different reasons why a small set of sample data might just happen to appear in the right order.
Explain why you want that order. If you can say what you want in English, somebody can help you code it in SQL.
I don't recommend any solution that uses UNION. It will be inefficient, and difficult to debug and to maintain. -
At the time of SOAP message reception DataHandler[] It is set to null.
It is DataHandler[] to the SOAP message from the Solaris environment. If it is used and a file is appended DataHandler[] which received It is set to null.
The transmission to Windows from Windows is appended satisfactory. In case a file is appended to a SOAP message, is there any setup peculiar to OS?Hello,
I'm not exactly sure as to your question; Windows works but the same
code on Solaris fails?
Concerning using the javax.activation.DataHandler data type, please see
the docs here [1] and example [2].
Hope this is of some value,
Bruce
[1]
http://edocs.bea.com/wls/docs81/webserv/implement.html#1074372
[2]
http://manojc.com/?sample5
Kenji Kashiwabara wrote:
>
It is DataHandler[] to the SOAP message from the Solaris environment. If it is used and a file is appended DataHandler[] which received It is set to null.
The transmission to Windows from Windows is appended satisfactory. In case a file is appended to a SOAP message, is there any setup peculiar to OS? -
Problem in creating jdbc-data-vew to oracle10g
I have installed DSEE7.0 and setup the directory proxy server successfully
my oracle environment:
ip=202.205.16.93
sid=nicdbs
table: CAMPUS.CAMPUS_USER { USERID, NAME, TEL, EMAIL }
my steps (refer to the administrator guide a reference):
dpconf create-jdbc-data-source -b nicdbs -B jdbc:oracle:thin://202.205.16.93:1521: -J file:///opt/sun/dsee7/var/jdbc/ojdbc14.jar -S oracle.jdbc.driver.OracleDriver oracleds
dpconf set-jdbc-data-source-prop oracleds db-vendor:oracle
dpconf set-jdbc-data-source-prop oracleds db-pwd-file:/etc/oraclepass.txt
dpconf create-jdbc-data-source-pool oraclepool
dpconf attach-jdbc-data-source oraclepool oracleds
dpconf create-jdbc-data-view oracleview oraclepool o=oracle
dpconf create-jdbc-table user CAMPUS.CAMPUS_USER
dpconf add-jdbc-attr user uid USERID
dpconf add-jdbc-attr user cn NAME
dpconf add-jdbc-attr user telephoneNumber TEL
dpconf add-jdbc-attr user mail EMAIL
dpconf create-jdbc-object-class oracleview person user uid
every thing return succefully
but when I test the view by
ldapsearch -b o=oralce -x uid=1422
it returns:
ldap_search: DSA is unavailable
ldap_search: additional info: Unable to process the search request. Reason: [Original error=52] No JDBC server available.
i cant get any help from this error message.I want some help, Maybe some steps were left.
thanks in advace.thanks but it didn't solve it,
ldapsearch -b o=oracle uid=1422
ldap_search: DSA is unavailable
ldap_search: additional info: Unable to process the search request. Reason: [Original error=52] No JDBC server available.
i also have tried:
db-name: (CONNECT_DATA =(SERVICE_NAME = nicdbs))
db-url: jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 202.205.16.93)(PORT = 1521)))
but it still didnt work.
#[root@dsee7 ~]# dpconf get-jdbc-data-source-prop oracleds
db-name : nicdbs
db-pwd : {3DES}+j6AoBZNIGx+7st/KDPgSmzVMlDcL6zs
db-url : jdbc:oracle:thin:@202.205.16.93:1521:
db-user : campus
db-vendor : oracle
description : -
driver-class : oracle.jdbc.driver.OracleDriver
driver-url : file:///opt/sun/dsee7/var/jdbc/ojdbc14.jar
is-enabled : true
is-read-only : false
monitoring-inactivity-timeout : 2m
monitoring-interval : 30s
monitoring-mode : reactive
num-connection-incr : 5
num-connection-init : 5
num-connection-limit : 30
#dpconf get-jdbc-data-view-prop oracleview
Enter "cn=Proxy Manager" password:
alternate-search-base-dn : ""
attr-name-mappings : none
base-dn : o=oracle
contains-shared-entries : false
custom-distribution-algorithm : none
description : -
distribution-algorithm : none
dn-join-rule : none
dn-mapping-attrs : none
dn-mapping-source-base-dn : none
excluded-subtrees : -
filter-join-rule : none
is-enabled : true
is-read-only : false
is-routable : true
jdbc-attr-date-format : yyyy-MM-dd
jdbc-attr-time-format : hh:mm:ss
jdbc-attr-timestamp-format : yyyy-MM-dd hh:mm:ss
jdbc-data-source-pool : oraclepool
lexicographic-attrs : all
lexicographic-lower-bound : none
lexicographic-upper-bound : none
non-viewable-attr : none
non-writable-attr : none
numeric-attrs : all
numeric-default-data-view : false
numeric-lower-bound : none
numeric-upper-bound : none
pattern-matching-base-dn-regular-expression : all
pattern-matching-base-object-search-filter : all
pattern-matching-dn-regular-expression : all
pattern-matching-one-level-search-filter : all
pattern-matching-subtree-search-filter : all
process-bind : -
replication-role : master
viewable-attr : all except non-viewable-attr
writable-attr : all except non-writable-attr
Edited by: mickypc1979 on Mar 1, 2010 4:31 PM -
Help! HTML Data set not working in IE (but in all other browsers)
Hi there,
I am totally desperate - I built a master/detail region page using a HTML data set.
http://www.atcongress.com/programme/continuousLearningByName.html
It works fine in Firefox/Safari/Chrome/Opera.
Only IE7 and IE8 give me grief - displaying javascript errors; apparrently it is not able to bind the HTML data table to the data set:
The IE Javascript Error Console displays "
'Spry.Data.HTMLDataSet' ist Null oder kein Objekt
This is in German but you'll get the idea I presume?! Translation would be something like
'Spry.Data.HTMLDataSet' is Null or not an object"
Anyway, the source HTML data table uses spry as well. This works fine on all browsers. Maybe because the HTML is on the same page?
http://www.atcongress.com/programme/continuousLearningTable.html
Any ideas? Do you need more info?
Please help - the system needs to go out to test users any day now!
Andreas
This is the entire message from the IE8 javascript error console:
Meldung: 'Spry.Data.HTMLDataSet' ist Null oder kein Objekt Zeile: 30 Zeichen: 1 Code: 0 URI: http://www.atcongress.com/programme/continuousLearningByName.html Meldung: 'Spry.Debug' ist Null oder kein Objekt Zeile: 961 Zeichen: 41 Code: 0 URI: http://www.atcongress.com/_spryAssets/SpryData.js Meldung: 'Spry.Data.initRegionsOnLoad' ist Null oder kein Objekt Zeile: 4855 Zeichen: 65 Code: 0 URI: http://www.atcongress.com/_spryAssets/SpryData.jsMore info on my trial & error process - error still in this case...
I cleaned up the code in both the problematic file and the source file that they validate fine now wit the W3C validator:
http://validator.w3.org/check?uri=http://www.atcongress.com/programme/continuousLearningBy Name.html&charset=(detect+automatically)&doctype=Inline&ss=1&outline=1&group=0&No200=1&ver bose=1&st=1&user-agent=W3C_Validator/1.1
Data source file:
http://validator.w3.org/check?uri=http%3A%2F%2Fwww.atcongress.com%2Fprogramme%2Fcontinuous LearningTable.html&charset=%28detect+automatically%29&doctype=Inline&ss=1&outline=1&group= 0&No200=1&verbose=1&st=1&user-agent=W3C_Validator%2F1.1
I'd also like to mention again that the source html file also contains an HTML data set and spry code. No problems there.
In order to make sure that is not a problem of referencing external data I also tried copying and pasting the source data table into the problematic file so that it can be used as a local data source. Still the same.
Apparently the probem is the master/detail region part. The working HTML spry file uses a standard HTML table whereas my problematic one uses a master/detail region
ANY help would be greatly appreciated!
Maybe you are looking for
-
This is ridiculous. Navigating the website, looking for that elusive telephone number for help. I don't know what wrong with Adobe's 10 flash player program and why it isn't working with my Windows 8 program. The Windows 8 test says I'm good to go
-
How to build a array with high sampling rates 1K
Hi All: Now I am trying to develop a project with CRio. But I am not sure how to build a array with high sampling rates signal, like >1K. (Sigle-point data) Before, I would like to use "Build Arrary" and "Shift Register" to build a arrary, but I foun
-
ADF Faces - Table update not completely rendered
Hi, [ myfaces 1.1.3 + ADF version 10.1.3.0.4 ] I have a problem with Table component, changing a value of the inputText components will not update the output component also inside the table. At least not rendered to HTML, the view-tree contains the u
-
I am starting to use a Mac mini for the first time and needing to buy a monitor for it. I am thinking of a 22inch or a 27 inch. Third party monitors though. Can't afford apple Cinema Display (27"). Will a 16:10 or a 16:9 fit for Mac mini's display? I
-
Video (DVD) on to IPods
I am new to the Mac world. My question is can DVD's be put onto IPods? I live in Canada and I am not able to download movies from I Tunes. So what I would like to do is put the movies I have bought on to the IPod. Can this be done?