A simple question...Constraints covering more than 1 table
Hello you all,
I got a simple question for a school project I have to do in Oracle. At least I think it will be simple for most people on this forum. But I can't figure it out. (Excuse me for the head title of the thread as well, but I don't know the exact term for this in english )
I can figure out how to do constraints in one table, for example:
'enddate > begindate'
But I got the following situation that I got the 2 following tables:
- Project
- Projectphase
I want to build in a constraint that prevents that the 'enddate' of the table 'Project' has an earlier date than the 'enddate' of the table 'Projectphase' because all projectphases have to be finished before a project can be finished.
I've tried to do this with constructions like 'Pro.Project.Enddate' and 'Pph.Projectphase.Enddate' but that doesn't work out.
So any help will be greatly appreciated.
I think what you want is called a "business rule". It can be implemented by using triggers on the tables, not constraints.
Tim
Similar Messages
-
ACR 5.6 preview covers more than actually opens
With the S90 the ACR 5.6 preview covers more image than actually opens in Camera Raw. It does however now match the JPG image when shooting both. It would be nice to have the extra available as an option without having to through the DNG tricks.
With the S90 the Adobe Standard Camera Profile seems to process the image considerably lighter than the JPG or the other camera profiles. I don't see this with the 5D Mk-II.MadManChan2000 wrote:
...the demosaic process in 5.7/LR3b2 no longer removes noise, compared to 5.6...
Eric
Eric
Does this just apply to process version 2010 or does it also apply to process version 2003?
If it applies to both, and assuming it also will apply to Lightroom 3 (which I plan to upgrade to), I will need to keep an earlier version of LR if I wish to print photographs processed earlier without any changes.
This is not a problem but it is good to know the answer before upgrading.
Regards
Nigel
PS Compliments to the CR/LR team as the noise reduction and sharpness improvements in LR3b2 are great, but sometimes one doesn't wish to spend additional time if reprinting old files. -
CFC question - dynamically changing more than just an argument
Hopefully this is really simple and obvious but I cna't find anything at the moment.
I have the following query
<cfquery name="dept" datasource="#dbdsnd#" username="#dbuname#" password="#dbpass#">
SELECT * from dept
WHERE deptCurrent = "Y"
AND deptID <> "0"
ORDER BY deptName
</cfquery>
which is currently in my cfm file but I'm trying to move into a cfc. This I can do!
The next stage of this would be to include arguments for the deptID. Again this I can do!
Where I'm struggling is trying use this for many purposes sticking to the deptID in the where clause I'm currently using the following variants (some in psuedo code sorry)
<cfif user neq "michael"><cfelse>And deptID <>"#value#"</cfif> (CFC objects to the cfif)
AND deptID = "#value#" (= rather than <>)
Is there an easy way? Could my argument be the whole line so I could use
SELECT * from dept
WHERE deptCurrent = "Y"
#ARGUMENT.deptIDcode#
ORDER BY deptName
Thanks
MichaelWriting this out seems to have answered my question - I can replace the line with #argument.xxx#
-
Simple question aboout PL/SQL nested tables
Hello, my question is about nested tables. Suppose I have a nested table:
TYPE int_array IS TABLE OF INT;
v_int_array int_array;
Is there a built in function to allow me to search v_int_array for a specific integer value?
GeorgeUse MEMBER OF operator:
declare
TYPE int_array IS TABLE OF INT;
v_int_array int_array := int_array(1,2,3,4,5);
begin
if 1 member of v_int_array
then
dbms_output.put_line('Found it!');
end if;
end;
Found it!
PL/SQL procedure successfully completed.
SQL> SY. -
Newbie question about using more than one Ipod on same computer
Hi everyone,
I finally got into the Apple world this year with a new (16 GB) iPhone. Love it. I've now ordered a Nano as well. My question is: though I know that my iTunes will recognize the Nano as a different iPod, will I be able to transfer the music I purchased from iTunes store with my iPhone and iTunes to the Nano? If so, how?
Thankswill I be able to transfer the music I purchased from iTunes store with my iPhone and iTunes to the Nano?
Music currently in iTunes can be transferred to the iPod nano the same way it was transferred to the iPhone. Content on the iPhone needs to be transferred to iTunes first.
(43837) -
How do I select more than one picture and send them all to Facebook on my iPhone 4s with iso7?
Hi, I want to thank you for all your information regarding my questions about sending more than one photo to Facebook. I did have to stop in at Verizon (where I bought my iPhone) to find out why I did not have a choice to choose Facebook with the export icon. The tech had to go into my setting and enable Facebook to recognize my iPhone. When I upgraded to iso7 somehow it could not recognize Facebook. Once he did this for me I was able to follow your advice and your answer solved my question. Thank you
-
I want to write a program that can play more tha one music file(wav).
I have used threat and mixer(javax.sound.sample.*) but Ican't do this.
Help me please !!!!!!
And show me some code example about mixer if can
Thank you very much !!!!!!!!Here is a simple solution for playing more than one sound at the time. It uses two classes where the first is a thread that plays a sound, and the second is a "container" that loads and stores your sounds.
SoundThread.java
import javax.sound.sampled.*;
public class SoundThread extends Thread
private Clip soundClip = null;
private int soundIndex = 0;
private int loopCount = 0;
private boolean donePlaying = false;
* Constructor
* @param acClip Clip The sound clip.
* @param index int The index of the sound (so that the correct thread can be found when a sound should be stopped.)
public SoundThread( Clip clip, int index )
soundIndex = index;
soundClip = clip;
soundClip.stop();
soundClip.flush();
soundClip.setFramePosition( 0 );
soundClip.setLoopPoints(0, -1);
setPriority(Thread.MIN_PRIORITY);
* Tell the thread to play the sound once and start playback.
public void playSound()
loopCount = 0;
start();
* Tell the thread to loop the sound and start playing.
public void loopSound()
loopCount = Clip.LOOP_CONTINUOUSLY;
start();
* Stop playing the sound in this thread.
public void stopSound()
soundClip.stop();
soundClip.flush();
soundClip.setFramePosition( 0 );
donePlaying = true;
* Get the index of this particular sound clip.
* @return int The index.
public int getSoundIndex()
return soundIndex;
* Has the sound finished playing?
* @return boolean True iff it's done.
public boolean isDonePlaying()
return donePlaying;
* Play the sound in the thread.
public void run()
soundClip.loop( loopCount );
donePlaying = true;
SoundPlayer.java
import javax.sound.sampled.*;
import java.net.URL;
import java.util.LinkedList;
import java.util.Vector;
public class SoundPlayer
private Vector<Clip> clipList = null;
private LinkedList<SoundThread> playerList = null;
* Constructor
* Initializes the list of sounds being played and the list of sound clips.
public SoundPlayer()
playerList = new LinkedList<SoundThread>();
clipList = new Vector<Clip>();
* Add a sound to the list of sounds in the player.
* @param fileName String The file name (including sub-directories) to the sound.
* @return int The index of the sound in the list, -1 if it could not be added.
* @throws UnsupportedAudioFileException The format of the file is unrecognized.
* @throws LineUnavailableException No output found.
* @throws IOException Most likely the file could not be found.
public int setSound( String fileName ) throws Exception
Clip theClip = getClip(getURL(fileName));
if ( clipList.add(theClip) == false )
theClip.flush();
theClip.close();
return -1;
return clipList.indexOf(theClip);
* Get a reference to a specific sound.
* @param soundIndex int The internal index of the sound.
* @return Clip A reference to the sound.
public Clip getSound( int soundIndex )
return clipList.elementAt(soundIndex);
* Play a sound.
* @param soundIndex int The internal index of the sound to be played.
public void play( int soundIndex )
SoundThread player = new SoundThread(getSound(soundIndex), soundIndex);
playerList.add(player);
player.playSound();
* Stop playing all sounds.
public void stop()
while ( playerList.isEmpty() == false )
SoundThread player = playerList.removeFirst();
player.stopSound();
player = null;
* Stop playing a specific looping sound.
* @param soundIndex int The internal index of the sound to be stopped.
public void stop( int soundIndex )
// Create a temporary list for sounds that are playing and should continue to play.
LinkedList<SoundThread> tempList = new LinkedList<SoundThread>();
while ( playerList.isEmpty() == false )
SoundThread player = playerList.removeFirst();
// This is the sound clip that should be stopped.
if ( player.getSoundIndex() == soundIndex )
player.stopSound();
// Remove any threads that are done playing.
if ( player.isDonePlaying() )
player = null;
// Add all other threads to the temporary list.
else
tempList.add(player);
// Update the player list to the new list.
playerList = tempList;
* Loop a sound.
* @param soundIndex int The internal index of the sound to be played.
public void loop( int soundIndex )
SoundThread player = new SoundThread(getSound(soundIndex), soundIndex);
playerList.add(player);
player.loopSound();
* Get an URL to a file inside the current jar archive.
* @param fileName String The file name, including subdierctory information if applicable.
* @return URL An URL to the file.
public URL getURL( String fileName )
return this.getClass().getClassLoader().getResource(fileName);
* Load a sound clip from an URL.
* @param urlResource URL An URL to the sound file.
* @return Clip A reference to the sound.
public Clip getClip( URL urlResource ) throws Exception
Clip theSound = null;
try
// Open a stream to the sound.
AudioInputStream ais = AudioSystem.getAudioInputStream( urlResource );
// Get the format of the sound clip.
AudioFormat af = ais.getFormat();
// Create a line for the sound clip.
DataLine.Info dli = new DataLine.Info( Clip.class, af, AudioSystem.NOT_SPECIFIED );
// If the format of the clip is not supported directly then try to transcode it to PCM.
if ( !AudioSystem.isLineSupported( dli ) )
// Create a new PCM audio format for the clip.
AudioFormat pcm = new AudioFormat( af.getSampleRate(), 16, af.getChannels(), true, false );
// Open a stream to the sound using the new format.
ais = AudioSystem.getAudioInputStream( pcm, ais );
// Read the format of the clip.
af = ais.getFormat();
// Create a new line for the sound clip.
dli = new DataLine.Info( Clip.class, af );
// Create the clip, open it, and read its entire contents.
theSound = ( Clip )AudioSystem.getLine( dli );
theSound.open( ais );
theSound.drain();
catch( Exception ex )
throw new Exception(urlResource.toString() + "\n" + ex.getMessage());
// Return a reference to the sound clip.
return theSound;
* Destructor
* Release memory used by loaded sounds.
public void dispose()
stop();
for ( int i = 0; i < clipList.size(); i++ )
Clip c = clipList.elementAt(i);
c.stop();
c.flush();
c.close();
clipList = null;
}Here is an example of how to use these classes:
public static final void main( String[] args )
try
SoundPlayer sp = new SoundPlayer();
int clip1 = sp.setSound("clip1.wav");
int clip2 = sp.setSound("mySounds/clip2.aiff");
int clip3 = sp.setSound("clip3.au");
sp.loop( clip1 );
Thread.sleep( 5000 );
sp.play( clip2 );
Thread.sleep( 1000 );
sp.play( clip3 );
Thread.sleep( 4000 );
sp.stop( clip1 );
sp.dispose();
catch( Exception ex )
ex.printStackTrace();
...The main weakness of this solution is that if you've got two or more instances of the same sound looping and want only one of them to stop, then, sorry, they're all stopped. There are probably more weak points but these two classes have worked well for my purposes so far.
Hope this solves at least part of your problem.
Hjalti
PS. I have assembled these two classes from code snippets and examples found here and there on the Web so I'm in no way claiming to be the original author of all of this code. Unfortunately I haven't registered where it all came from so I'm unable to give credit where credit is due. -
Can we have more than one primary key constraint to a Oracle Table?
Hi,
Can we have more than one primary keys to a single table in oracle? ( Not the composite key)
Please somebody answer..
Regards,
Alaka811935 wrote:
Can we have more than one primary keys to a single table in oracle? ( Not the composite key)
In principle a table can have multiple keys if you need them. It is a very strong convention that just one of those keys is designated to be "primary" but that's just a convention and it doesn't stop you implementing other keys as well.
Oracle provides two uniqueness constraints for creating keys: the PRIMARY KEY constraint and the UNIQUE constraint. The PRIMARY KEY constraint can only be used once per table whereas the UNIQUE constraint can be used multiple times. Other than that the PRIMARY KEY and UNIQUE constraints serve the same function (always assuming the column(s) they are applied to are NOT NULL). -
Simple journalization with more than one table
Hello,
I wanted to journalize more than one table with a simpe journalization?
is it possible?
I confgured my OdiWaitForLogData like that:
OdiWaitForLogData "-CONTEXT=GLOBAL" "-GLOBAL_ROWCOUNT=2" "-LSCHEMA=employe" "-OPTIMIZED_WAIT=AUTO" "-POLLINT=2000" "-SUBSCRIBER_NAME=SUNOPSIS" "-TIMEOUT=0" "-TIMEOUT_WITH_ROWS_OK=YES" "-UNIT_ROWCOUNT=1" "-TABLE_NAME=Departement,Employe"
when I executed my interface, my interface is still at the step running.
what happened please?
Thanks
BillyroseHello,
I wanted to journalize more than one table with a simpe journalization?
is it possible?
I confgured my OdiWaitForLogData like that:
OdiWaitForLogData "-CONTEXT=GLOBAL" "-GLOBAL_ROWCOUNT=2" "-LSCHEMA=employe" "-OPTIMIZED_WAIT=AUTO" "-POLLINT=2000" "-SUBSCRIBER_NAME=SUNOPSIS" "-TIMEOUT=0" "-TIMEOUT_WITH_ROWS_OK=YES" "-UNIT_ROWCOUNT=1" "-TABLE_NAME=Departement,Employe"
when I executed my interface, my interface is still at the step running.
what happened please?
Thanks
Billyrose -
Creating SQL-Loader script for more than one table at a time
Hi,
I am using OMWB 2.0.2.0.0 with Oracle 8.1.7 and Sybase 11.9.
It looks like I can create SQL-Loader scripts for all the tables
or for one table at a time. If I want to create SQL-Loader
scripts for 5-6 tables, I have to either create script for all
the tables and then delete the unwanted tables or create the
scripts for one table at a time and then merge them.
Is there a simple way to create migration scripts for more than
one but not all tables at a time?
Thanks,
Prashant RaneNo there is no multi-select for creating SQL-Loader scripts.
You can either create them separately or create them all and
then discard the one you do not need. -
How to come up with a magic number for any table that returns more than 32KB?
I am in a unique situation where in I am trying to retrieve values from multiple tables and publish them as XML output. The problem is based on the condition a few tables could retrieve data more than 32KB and a few less than 32KB. Less than 32KB is not an issue as XML generation is smooth. The minute it reaches greater than 32KB it generates a run time error. Just wondering if there is any way to ensure that the minute the query's results is greater than 32 kb, it should break say - if the results is 35KB, then I should break that result into 32 KB and 3kb; once done then pass this data to be published as an XML output. This is again not just for one table, but all the tables that are called in the function.
Is there any way?? I am unable to get any ideas nor have I done anything so complex from production support stand point. Would appreciate if someone can guide me on this.
The way it is, is as follows:
I have a table called ctn_pub_cntl
CREATE TABLE CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id NUMBER(18)
,table_name VARCHAR2(50)
,last_pub_tms DATE
,queue_name VARCHAR2(50)
,dest_system VARCHAR2(50)
,frequency NUMBER(6)
,status VARCHAR2(8)
,record_create_tms DATE
,create_user_id VARCHAR2(8)
,record_update_tms DATE
,update_user_id VARCHAR2(8)
,CONSTRAINT ctn_pub_cntl_id_pk PRIMARY KEY(ctn_pub_cntl_id)
Data for this is:
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_SBDVSN'
,TO_DATE('10/2/2004 10:17:44PM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.TSZ601.UNP'
,'SAP'
,15
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_TRACK_SGMNT_DN'
,TO_DATE('02/06/2015 9:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.WRKORD.UNP'
,'SAP'
,30
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_FXPLA_TRACK_LCTN_DN'
,TO_DATE('10/2/2004 10:17:44PM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.YRDPLN.INPUT'
,'SAP'
,30
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_FXPLA_TRACK_LCTN2_DN'
,TO_DATE('02/06/2015 9:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.TSZ601.UNP'
,'SAP'
,120
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_FXPLA_TRACK_LCTN2_DN'
,TO_DATE('04/23/2015 11:50:00PM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.YRDPLN.INPUT'
,'SAP'
,10
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_FIXED_PLANT_ASSET'
,TO_DATE('04/23/2015 11:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.WRKORD.UNP'
,'SAP'
,10
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_OPRLMT'
,TO_DATE('03/26/2015 7:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.WRKORD.UNP'
,'SAP'
,30
INSERT INTO CTNAPP.ctn_pub_cntl
(ctn_pub_cntl_id
,table_name
,last_pub_tms
,queue_name
,dest_system
,frequency
VALUES
(CTNAPP_SQNC.nextval
,'TRKFCG_OPRLMT_SGMNT_DN'
,TO_DATE('03/28/2015 12:50:00AM','MM/DD/YYYY HH12:MI:SSPM')
,'UT.TSD.WRKORD.UNP'
,'SAP'
,30
COMMIT;
Once the above data is inserted and committed, then I created a function in a package:
CREATE OR REPLACE PACKAGE CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH
IS
TYPE tNameTyp IS TABLE OF ctn_pub_cntl.table_name%TYPE INDEX BY BINARY_INTEGER;
g_tName tNameTyp;
TYPE tClobTyp IS TABLE OF CLOB INDEX BY BINARY_INTEGER;
g_tClob tClobTyp;
FUNCTION GetCtnData(p_nInCtnPubCntlID IN CTN_PUB_CNTL.ctn_pub_cntl_id%TYPE,p_count OUT NUMBER ) RETURN tClobTyp;
END CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH;
--Package body
CREATE OR REPLACE PACKAGE BODY CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH
IS
doc xmldom.DOMDocument;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
root_elmt xmldom.DOMElement;
child_node xmldom.DOMNode;
child_elmt xmldom.DOMElement;
leaf_node xmldom.DOMNode;
elmt_value xmldom.DOMText;
tbl_node xmldom.DOMNode;
table_data XMLDOM.DOMDOCUMENTFRAGMENT;
l_ctx DBMS_XMLGEN.CTXHANDLE;
vStrSqlQuery VARCHAR2(32767);
l_clob tClobTyp;
l_xmltype XMLTYPE;
--Local Procedure to build XML header
PROCEDURE BuildCPRHeader IS
BEGIN
child_elmt := xmldom.createElement(doc, 'PUBLISH_HEADER');
child_node := xmldom.appendChild (root_node, xmldom.makeNode (child_elmt));
child_elmt := xmldom.createElement (doc, 'SOURCE_APLCTN_ID');
elmt_value := xmldom.createTextNode (doc, 'CTN');
leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
child_elmt := xmldom.createElement (doc, 'SOURCE_PRGRM_ID');
elmt_value := xmldom.createTextNode (doc, 'VALUE');
leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
child_elmt := xmldom.createElement (doc, 'SOURCE_CMPNT_ID');
elmt_value := xmldom.createTextNode (doc, 'VALUE');
leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
child_elmt := xmldom.createElement (doc, 'PUBLISH_TMS');
elmt_value := xmldom.createTextNode (doc, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS'));
leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
END BuildCPRHeader;
--Get table data based on table name
FUNCTION GetCtnData(p_nInCtnPubCntlID IN CTN_PUB_CNTL.ctn_pub_cntl_id%TYPE,p_Count OUT NUMBER) RETURN tClobTyp IS
vTblName ctn_pub_cntl.table_name%TYPE;
vLastPubTms ctn_pub_cntl.last_pub_tms%TYPE;
BEGIN
g_vProcedureName:='GetCtnData';
g_vTableName:='CTN_PUB_CNTL';
SELECT table_name,last_pub_tms
INTO vTblName, vLastPubTms
FROM CTN_PUB_CNTL
WHERE ctn_pub_cntl_id=p_nInCtnPubCntlID;
-- Start the XML Message generation
doc := xmldom.newDOMDocument;
main_node := xmldom.makeNode(doc);
root_elmt := xmldom.createElement(doc, 'PUBLISH');
root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));
--Append Table Data as Publish Header
BuildCPRHeader;
--Append Table Data as Publish Body
child_elmt := xmldom.createElement(doc, 'PUBLISH_BODY');
leaf_node := xmldom.appendChild (root_node, xmldom.makeNode(child_elmt));
DBMS_SESSION.SET_NLS('NLS_DATE_FORMAT','''YYYY:MM:DD HH24:MI:SS''');
vStrSqlQuery := 'SELECT * FROM ' || vTblName
|| ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
-- || ' AND rownum < 16'
DBMS_OUTPUT.PUT_LINE(vStrSqlQuery);
l_ctx := DBMS_XMLGEN.NEWCONTEXT(vStrSqlQuery);
DBMS_XMLGEN.SETNULLHANDLING(l_ctx, 0);
DBMS_XMLGEN.SETROWSETTAG(l_ctx, vTblName);
-- Append Table Data as XML Fragment
l_clob(1):=DBMS_XMLGEN.GETXML(l_ctx);
elmt_value := xmldom.createTextNode (doc, l_clob(1));
leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value));
xmldom.writeToBuffer (doc, l_clob(1));
l_clob(1):=REPLACE(l_clob(1),'<?xml version="1.0"?>', NULL);
l_clob(1):=REPLACE(l_clob(1),'<', '<');
l_clob(1):=REPLACE(l_clob(1),'>', '>');
RETURN l_clob;
DBMS_OUTPUT.put_line('Answer is' ||l_clob(1));
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.put_line('There is no data with' || SQLERRM);
g_vProcedureName:='GetCtnData';
g_vTableName:='CTN_PUB_CNTL';
g_vErrorMessage:=SQLERRM|| g_vErrorMessage;
g_nSqlCd:=SQLCODE;
ctn_log_error('ERROR',g_vErrorMessage,'SELECT',g_nSqlCd,p_nInCtnPubCntlID,g_vPackageName,g_vProcedureName,g_vTableName);
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR : ' || SQLERRM);
ctn_log_error('ERROR',g_vErrorMessage,'OTHERS',g_nSqlCd,p_nInCtnPubCntlID,g_vPackageName,g_vProcedureName,g_vTableName);
END GetCtnData;
PROCEDURE printClob (result IN OUT NOCOPY CLOB) IS
xmlstr VARCHAR2 (32767);
line VARCHAR2 (2000);
BEGIN
xmlstr := DBMS_LOB.SUBSTR (result, 32767);
LOOP
EXIT WHEN xmlstr IS NULL;
line := SUBSTR (xmlstr, 1, INSTR (xmlstr, CHR (10)) - 1);
DBMS_OUTPUT.put_line (line);
xmlstr := SUBSTR (xmlstr, INSTR (xmlstr, CHR (10)) + 1);
END LOOP;
END printClob;
END CTN_PUB_CNTL_EXTRACT_PUBLISH;
If you notice my query:
vStrSqlQuery := 'SELECT * FROM ' || vTblName
|| ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
|| ' AND rownum < 16'
The minute I comment
|| ' AND rownum < 16' ;
, it throws an error because this query returns around 600 rows and all of those rows need to be published as XML and the tragedy is that there is a C program in between as well i.e. C will call my packged functions and then will do all the processing. Once this is done will pass the results back to C program. So obviously C does not recognise CLOB and somewhere in the process I have to convert the CLOB to VARCHAR or instead of CLOB I have to use VARCHAR array as a return type. This is my challenge.
Anyone that can help me to find out the required magic number and also a brief know how, I would appreciate that. Many thanks in advance.Not sure I understand which part is failing.
Is it the C program calling your packaged function? Or does the error occur in the PL/SQL code, in which case you should be able to pinpoint where it's wrong?
A few comments :
1) Using DOM to build XML out of relational data? What for? Use SQL/XML functions.
2) Giving sample data is usually great, but it's not useful here since we can't run your code. We're missing the base tables.
3) This is wrong :
vStrSqlQuery := 'SELECT * FROM ' || vTblName || ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ;
A bind variable should be used here for the date.
4) This is wrong :
elmt_value := xmldom.createTextNode (doc, l_clob(1));
createTextNode does not support CLOB so it will fail as soon as the CLOB you're trying to pass exceeds 32k.
Maybe that's the problem you're referring to?
5) This is most wrong :
l_clob(1):=REPLACE(l_clob(1),'<?xml version="1.0"?>', NULL);
l_clob(1):=REPLACE(l_clob(1),'<', '<');
l_clob(1):=REPLACE(l_clob(1),'>', '>');
I understand what you're trying to do but it's not the correct way.
You're trying to convert a text() node representing XML in escaped form back to XML content.
The problem is that there are other things to take care of besides just '<' and '>'.
If you want to insert an XML node into an existing document, treat that as an XML node, not as a string.
Anyway,
Anyone that can help me to find out the required magic number
That would be a bad idea. Fix what needs to be fixed.
And please clearly state which part is failing : the C program or the PL/SQL code?
I'd vote for PL/SQL, as pointed out in [4]. -
How can I enter my podcast in more than one category, to reflect the fact that it covers arts, education and society and culture? Thank you for your time!
You can have more than one category - this page shows you how the tags are formed:
http://www.apple.com/itunes/podcasts/specs.html#category
The Store will list only the first category and its sub-category at the top of the page. Like the first category, the others will in theory make your podcast available for searching by category. However searching just on the category in the iTunes Store is most unlikely to throw up your podcast. There are thousands of podcasts out there, and it would be quite impossible to display on one page the entire list for any category. What you see are 'featured' podcasts, chosen by Apple as being special; please see this Tech Note:
http://www.apple.com/itunes/podcasts/specs.html#getfeatured
Note that there is no way you can influence the selection other than making your podcast really special.
If you have further questions about making your podcast it's better to ask them in the Producing Podcasts forum. -
How to print a graph in which internal table has more than 32 entries?
hiii experts
i am trying to make a line graph using 'gfw_pres_show' function module.
but in report internal table has more than 32 entries
so how can i print a graph having more than 32 entries?Hi ricky_lv,
According to your description, there is main report and subreport in it, when the subreport spans across multiple pages, you want to show column headers on each page. If that is the case, we can set column headers visible while scrolling in main report.
For detail information, please refer to the following steps:
In design mode, click the small drop down arrow next to Column Groups and select Advanced Mode.
Go to your Row Groups pane, click on the first static member.
In properties grid, set FixData to True.
Set RepeatOnNextPage to True.
Here is a relevant thread you can reference:
https://social.technet.microsoft.com/Forums/en-US/e1f67cec-8fa3-4c5d-86ba-28b57fc4a211/keep-header-rows-visible-while-scrolling?forum=sqlreportingservi
The following screenshots are for your reference:
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
If you have any feedback on our support, please click
here.
Wendy Fu
TechNet Community Support -
Shortest path with more than one traveler and time constraints
Please have a look at this problem...Thank you..
(the problem is ok with one traveler. but when two or more come into the picture they really mess things up)
Here it is
I have a number of destinations that devides evenly up between a
number of travelers. (5 travelers with 20 destinations = 4
destinations each)
All destination can be visited by all travelers but it can ony be visited once
Each destination has to be visited and
each traveler has to visit the same amount of destinations.
The total amount of traveling has to be minimized.
Grid references have been given to work out the distance between each
destination. (the distances have not been worked out prior to the
start of the problem)
The starting point of each traveler is not at any of the destinations
and is different to each other. This point is also known and can be
used to calculate the distance to any destination.
there is an extra part of the problem (which I think I can sort out but if its of interest here it is any way): Each destination can only be
visited at a certain time of the day (ie between 7- 9 and 9-12 and
12-3 and 3-6)
A typical problem would have about 300 destinations and about 50
travelers every day. ie about 6 destination a day per traveler.
Could any one please give me an idea of how you would go about working the
routes out for each traveler that minimizes travelling distance as there is no algorithm that does this kind of routing.
I would really like some help with this one please. I have many ideas of how to do it but i really feel like it is not optimised...
I have to complete this in one week and have no AI experiance ( I would like to do this without AI or anything to do with ant colonies and or swarm optimization)
Thank you.The reason that the time is in fact a simple constraint is because this is a homework problem and the kids only have a week to work on it. If it were a real world problem you you not conveniently have the number of travelers divide evenly into the number of cities.
If it were not some homework problem you would not have a constraint that reads "Oh by the way, for extra credit, you can only visit some cities at certain times during the day." It would either be a real constraint or not.
The other indication that it is a homework problem is that the student was given a week to do it. I will perhaps be going out on a limb here, but NO reasonable business gives some bozo one week to complete an assignment for which the bozo is so clueless that he has to hit the net and ask random people if they can tell him how to do it.
Had there been any need to model travel time, then velocity of travelers would have been mentioned at some point. If the traveler were actually doing anything in a city, time to load or unload the truck would have been given. And lastly, what real world problem would add a constraint that no two travelers could go to the same city. What if it is shorter to get from A to C by going through B which has already been visited. This constraint was the tip that the solution was a partition of a set of cities.
My gross simplification is merely that this is a homework problem and therfore if I haven't been told otherwise I am free to assume that a traveler moving at infinite velocity is perfectly OK. This means that my traveler waits at the door to a city until it opens, picks off that city and all other in zero time, until it bangs up against a city that opens at a later time, where it must again wait till opening time. The only thing that prevents him from completing his circuit is if an early city comes after a late city. A simple sort is all you need.
Lastly, even if you want to toss in a more complicated velocity model, it does little more than mildly complicate the sort comparison calculation so instead of making the comparison
boolean ICanMakeIt = city.openingTime <= city[i+1].openingTime
it becomes
boolean ICanMakeIt = city.exitTime +
Traveler[j].vel*dist(i,i+1) <= city[i+1].closingTime
I think you are mistaken in declaring this to be a difficult modeling problem -
ORA-00604 & ORA-30512 CANNOT MODIFY TABLE MORE THAN ONCE IN A TRANSACTION
We have a requirement where two tables should be in sync at any given point
in time with respect to the structure of the tables.
Any change on table/column via ALTER (MODIFY, ADD, RENAME COLUMN, DROP
COLUMN) on the parent table should be replicated to the replica table.
I created a DDL_TRIGGER on the schema and the desired result is achieved but
for the following one scenario for which its failing.
The issue is, if we try to reduce the width of the column (via ALTER ..
MODIFY) it fails with the following error
ORA-00604: error occurred at recursive SQL level 1
ORA-30512: cannot modify DEVTESTF_OIM.REPLICA_ABC more than once in a
transaction
Please follow the steps to reproduce the issue (the issue is across the DB
version checked on 10.2, 11.1 and 11.2 DB version)
-- Step1 Create Parent Table
CREATE TABLE abc (col1 VARCHAR2(10))
-- Step2 Create Replica Table
CREATE TABLE replica_abc (col1 VARCHAR2(10))
-- Step3 Create DDL Trigger
CREATE OR REPLACE TRIGGER ddl_trigger
AFTER ALTER ON SCHEMA
DECLARE
operation VARCHAR2(30);
object_name VARCHAR2(30);
l_sqltext VARCHAR2(100);
i PLS_INTEGER;
l_count NUMBER:=0;
sql_text dbms_standard.ora_name_list_t;
BEGIN
i := dbms_standard.sql_txt(sql_text);
SELECT ora_sysevent, ora_dict_obj_name, UPPER(sql_text(i))
INTO operation, object_name, l_sqltext
FROM dual;
IF ora_dict_obj_name = 'ABC' THEN
l_count := INSTR(l_sqltext,'ADD CONSTRAINT',1,1);
l_count := l_count + INSTR(l_sqltext,'DISABLE',1,1);
l_count := l_count + INSTR(l_sqltext,'DROP CONSTRAINT',1,1);
l_count := l_count + INSTR(l_sqltext,'PRIMARY KEY',1,1);
l_count := l_count + INSTR(l_sqltext,'ADD CHECK',1,1);
IF (l_count = 0) THEN
l_count := INSTR(l_sqltext,'ADD',1,1);
l_count := l_count + INSTR(l_sqltext,'MODIFY',1,1);
l_count := l_count + INSTR(l_sqltext,'DROP COLUMN',1,1);
l_count := l_count + INSTR(l_sqltext,'RENAME
COLUMN',1,1);
IF (l_count >0) THEN
l_sqltext := REPLACE(l_sqltext,'TABLE ABC','TABLE REPLICA_ABC');
execute immediate l_sqltext;
END IF;
END IF;
END IF;
EXCEPTION
WHEN OTHERS THEN
RAISE ;
END;
-- Step 4 Issue the following ALTER command on the Parent table 'ABC'
ALTER TABLE ABC MODIFY COL1 VARCHAR2(9);
will show the following
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-30512: cannot modify DEVTESTF_OIM.REPLICA_ABC more than once in a
transaction
ORA-06512: at line 34
whereas the following commands works fine
ALTER TABLE ABC MODIFY COL1 VARCHAR2(11);
and also the rest of the operations
ALTER TABLE ABC ADD COL2 VARCHAR2(20);
ALTER TABLE ABC RENAME COLUMN COL2 TO COL3;
ALTER TABLE ABC DROP COLUMN COL3;
The issue is while reducing the size of VARCHAR2 columns, while the rest of
option works fine.
Any suggestion or workaround please.It looks like a bug to me. The failing statement from the SQL trace is
PARSE ERROR #12:len=77 dep=3 uid=0 oct=3 lid=0 tim=1263332549608656 err=30512
select /*+ first_rows */ 1 from "TIM"."REPLICA_ABC" where LENGTHB("COL1") > 9and exception cannot explain it.
Maybe you are looking for
-
I've got about 3 yrs of pictures, which are backed up, but the "upgrade" to iPhoto six (which I now regret having paid for) crashes on launch every time. I tried all the tricks I could find in this forum: the cmd-opt launch, and each of the rebuilt o
-
Some of my songs in itunes are not syncing. please help
the subject explains the problem. is there any program that will download songs to iphone without itunes doing it. itunes is not syncing all my songs Mary
-
Mac mini screen res changes through gcs634u
I have a mac mini and use it via a 2port Iogear kvm to a HP2408 @1920x1200 resolution. I just bought a new 4port Iogear 634u but when i connect the mac it changes the resolution to 1280x1024 and does not give me the option to do 1920x1200 at all. If
-
No icon for nokia mail in 7.8 on lumia710 in live ...
Hi ... I have a Lumia 710 running on wp7.8 Firmware version - 1600.3036.8858.12460 I have pinned the Nokia mail to start but when I make the tile smallest there was no icon of Nokia mail .... I thought it is a temporary problem and I reset my phone b
-
TSAFSGW selections through BackupExec ?
Well, since its a cluster and since tsafsgw is the current solution, we now try to redo /redesign the backup jobs. Some issues/thoughts, Previoulsy with tsafs and gwtsa, backup was done -by server -by cluster-resource (virtual FILEserver according to