<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments for Peoplesoft and SQR</title>
	<atom:link href="http://peoplesoftsqr.com/index.php/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://peoplesoftsqr.com</link>
	<description>When Peoplebooks Is Not Enough</description>
	<lastBuildDate>Wed, 02 May 2012 20:03:53 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Comment on 9 SQL Parameters: Load-Lookup Love Letter by dwasifar</title>
		<link>http://peoplesoftsqr.com/index.php/2009/03/9-sql-parameters-load-lookup-love-letter/comment-page-1/#comment-8139</link>
		<dc:creator>dwasifar</dc:creator>
		<pubDate>Wed, 02 May 2012 20:03:53 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=206#comment-8139</guid>
		<description>Now that I think about it, you could use all the above logic to build one giant dynamic $Where clause variable containing all the possible variations, instead of hitting the temp table multiple times.</description>
		<content:encoded><![CDATA[<p>Now that I think about it, you could use all the above logic to build one giant dynamic $Where clause variable containing all the possible variations, instead of hitting the temp table multiple times.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 9 SQL Parameters: Load-Lookup Love Letter by dwasifar</title>
		<link>http://peoplesoftsqr.com/index.php/2009/03/9-sql-parameters-load-lookup-love-letter/comment-page-1/#comment-8133</link>
		<dc:creator>dwasifar</dc:creator>
		<pubDate>Wed, 02 May 2012 18:42:18 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=206#comment-8133</guid>
		<description>Okay, this is kind of a brute force approach, but:

I&#039;m assuming PERS_NID is too big to comfortably load into an array, so we&#039;ll do it with individual selects.

1) Create a temp table mirroring PERS_NID.  Run through the file once looking at PERS_NID for exact matches.  For each exact match, knock that row out of the temp table.  This reduces the chance of a bad guess in the subsequent steps.

2) Create a local procedure - let&#039;s call it Test-All - which takes two input parms: the SSN being tested and the suspect character position.  This procedure tries the temp table for each digit 0 through 9 in that position until it finds a match (presumably by calling another procedure, not by using 10 distinct queries).

3) If the SSN being tested is short one character, do a loop to insert &#039;x&#039; in each position where a character could have been missed and call Test-All specifying that position.  (e.g. if you have 12345678, call it for x12345678 with suspect position as 1, 1x2345678 with suspect position as 2, and so on through 12345678x.)

4) Parse the SSN being tested for specials or alphas.  If one is found, that&#039;s your suspect character position for calling the Test-All procedure.

5) If no specials or alphas were found in step 2, run Test-All for each position 1 through 9 in sequence, looking for a single wrong digit.

6) If still no match, do a loop to parse the SSN under test and swap pairs of adjacent digits.  For instance, if the test is 123456789, then the first loop iteration should be 213456789, the second should be 132456789, and so on.  Test each against the temp table.

7) If still no match, do a similar loop to swap pairs of nonadjacent digits.

8) If still no match, the SSN has more than one problem.  Print it on a report and send an email to the idiots who sent you the bad import file.</description>
		<content:encoded><![CDATA[<p>Okay, this is kind of a brute force approach, but:</p>
<p>I&#8217;m assuming PERS_NID is too big to comfortably load into an array, so we&#8217;ll do it with individual selects.</p>
<p>1) Create a temp table mirroring PERS_NID.  Run through the file once looking at PERS_NID for exact matches.  For each exact match, knock that row out of the temp table.  This reduces the chance of a bad guess in the subsequent steps.</p>
<p>2) Create a local procedure &#8211; let&#8217;s call it Test-All &#8211; which takes two input parms: the SSN being tested and the suspect character position.  This procedure tries the temp table for each digit 0 through 9 in that position until it finds a match (presumably by calling another procedure, not by using 10 distinct queries).</p>
<p>3) If the SSN being tested is short one character, do a loop to insert &#8216;x&#8217; in each position where a character could have been missed and call Test-All specifying that position.  (e.g. if you have 12345678, call it for x12345678 with suspect position as 1, 1&#215;2345678 with suspect position as 2, and so on through 12345678x.)</p>
<p>4) Parse the SSN being tested for specials or alphas.  If one is found, that&#8217;s your suspect character position for calling the Test-All procedure.</p>
<p>5) If no specials or alphas were found in step 2, run Test-All for each position 1 through 9 in sequence, looking for a single wrong digit.</p>
<p>6) If still no match, do a loop to parse the SSN under test and swap pairs of adjacent digits.  For instance, if the test is 123456789, then the first loop iteration should be 213456789, the second should be 132456789, and so on.  Test each against the temp table.</p>
<p>7) If still no match, do a similar loop to swap pairs of nonadjacent digits.</p>
<p> <img src='http://peoplesoftsqr.com/wordpress/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> If still no match, the SSN has more than one problem.  Print it on a report and send an email to the idiots who sent you the bad import file.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Bug in Every Peoplesoft SQR Program by administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2011/12/the-bug-in-every-peoplesoft-sqr-program/comment-page-1/#comment-8043</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Wed, 11 Apr 2012 15:48:25 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=724#comment-8043</guid>
		<description>Thanks - that&#039;s good code for us to emulate.</description>
		<content:encoded><![CDATA[<p>Thanks &#8211; that&#8217;s good code for us to emulate.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Bug in Every Peoplesoft SQR Program by Stan The Man II</title>
		<link>http://peoplesoftsqr.com/index.php/2011/12/the-bug-in-every-peoplesoft-sqr-program/comment-page-1/#comment-8006</link>
		<dc:creator>Stan The Man II</dc:creator>
		<pubDate>Thu, 29 Mar 2012 23:22:28 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=724#comment-8006</guid>
		<description>We have programs that assumed the Run Control row was present and not the PeopleCode validating the data. So, the SQR would validate the parameters and abort with message in the log as needed.
   I just fixed one where the Process Definition was a job containing an App Engine and an SQR using two different Run Control Tables. To work, both needed the same Run Control ID. User did not set up that way. SQR got no parameters because process instance was interogated as Stan The Man said.
   The best cure I have is listed below.
   Move &#039;N&#039; To $RowInTbl
Begin-Select  LOOPS = 1
param.BEGIN_TERM
param.END_TERM

   Move &#039;Y&#039; To $RowInTbl
 
FROM  ps_fciap_rnctl param                                    
WHERE param.OPRID = $prcs_oprid
AND   param.RUN_CNTL_ID = $prcs_run_cntl_id
End-Select
!
   If $RowInTbl = &#039;N&#039;
      Show &#039;This program must be run from the Process Monitor.&#039;
      Stop Quiet 
   End-If
(Any other validations go here)
(Continue your job)
Enjoy!</description>
		<content:encoded><![CDATA[<p>We have programs that assumed the Run Control row was present and not the PeopleCode validating the data. So, the SQR would validate the parameters and abort with message in the log as needed.<br />
   I just fixed one where the Process Definition was a job containing an App Engine and an SQR using two different Run Control Tables. To work, both needed the same Run Control ID. User did not set up that way. SQR got no parameters because process instance was interogated as Stan The Man said.<br />
   The best cure I have is listed below.<br />
   Move &#8216;N&#8217; To $RowInTbl<br />
Begin-Select  LOOPS = 1<br />
param.BEGIN_TERM<br />
param.END_TERM</p>
<p>   Move &#8216;Y&#8217; To $RowInTbl</p>
<p>FROM  ps_fciap_rnctl param<br />
WHERE param.OPRID = $prcs_oprid<br />
AND   param.RUN_CNTL_ID = $prcs_run_cntl_id<br />
End-Select<br />
!<br />
   If $RowInTbl = &#8216;N&#8217;<br />
      Show &#8216;This program must be run from the Process Monitor.&#8217;<br />
      Stop Quiet<br />
   End-If<br />
(Any other validations go here)<br />
(Continue your job)<br />
Enjoy!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 9 SQL Parameters: Load-Lookup Love Letter by administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2009/03/9-sql-parameters-load-lookup-love-letter/comment-page-1/#comment-7985</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Sat, 24 Mar 2012 22:17:50 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=206#comment-7985</guid>
		<description>This question is somewhat outside my expertise (stored procedures, database administration, server management), not specific enough (I can&#039;t tune SQL I haven&#039;t seen), and beyond my resources (I don&#039;t have the systems to check it out).  But, here goes.  You mention that one virtual server (a simulated server that is a fraction of the actual hardware) worked 50% (yeah, that&#039;s a lot) for 3 seconds during down time (do you mean while it&#039;s not busy?).  The first question is - is this really a problem unless it gets worse?

If it&#039;s really a problem that deserves 100 hours of your time to fix, perhaps you should reconsider your algorithm.  It sounds like you&#039;re comparing the data dictionaries of two databases to keep one in sync with the adds and deletes of the other.  Are you performing complete outer joins?  That&#039;s very thorough and a lot of extra work if you&#039;re expecting a 99% match.  Another approach would be for each database instance to run an SQR to sort the database objects and write them to disk files.  Then another SQR program could read both files into arrays and compare the arrays row by row.</description>
		<content:encoded><![CDATA[<p>This question is somewhat outside my expertise (stored procedures, database administration, server management), not specific enough (I can&#8217;t tune SQL I haven&#8217;t seen), and beyond my resources (I don&#8217;t have the systems to check it out).  But, here goes.  You mention that one virtual server (a simulated server that is a fraction of the actual hardware) worked 50% (yeah, that&#8217;s a lot) for 3 seconds during down time (do you mean while it&#8217;s not busy?).  The first question is &#8211; is this really a problem unless it gets worse?</p>
<p>If it&#8217;s really a problem that deserves 100 hours of your time to fix, perhaps you should reconsider your algorithm.  It sounds like you&#8217;re comparing the data dictionaries of two databases to keep one in sync with the adds and deletes of the other.  Are you performing complete outer joins?  That&#8217;s very thorough and a lot of extra work if you&#8217;re expecting a 99% match.  Another approach would be for each database instance to run an SQR to sort the database objects and write them to disk files.  Then another SQR program could read both files into arrays and compare the arrays row by row.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Bug in Every Peoplesoft SQR Program by administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2011/12/the-bug-in-every-peoplesoft-sqr-program/comment-page-1/#comment-7984</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Sat, 24 Mar 2012 21:52:10 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=724#comment-7984</guid>
		<description>That is an excellent idea. I’m not sure whether you’re responding to this particular post or just sharing some good advice. That practice isn’t enough to save you from the bug I discussed here – a missing run control row. The IF test detects whether there was a process instance number on the command line, which usually indicates whether the SQR program was run from the Peoplesoft Process Scheduler. (Of course, we can add a fake process instance number to the SQRW command line to test that code.)</description>
		<content:encoded><![CDATA[<p>That is an excellent idea. I’m not sure whether you’re responding to this particular post or just sharing some good advice. That practice isn’t enough to save you from the bug I discussed here – a missing run control row. The IF test detects whether there was a process instance number on the command line, which usually indicates whether the SQR program was run from the Peoplesoft Process Scheduler. (Of course, we can add a fake process instance number to the SQRW command line to test that code.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on The Bug in Every Peoplesoft SQR Program by Stan the Man</title>
		<link>http://peoplesoftsqr.com/index.php/2011/12/the-bug-in-every-peoplesoft-sqr-program/comment-page-1/#comment-7978</link>
		<dc:creator>Stan the Man</dc:creator>
		<pubDate>Fri, 23 Mar 2012 22:49:09 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=724#comment-7978</guid>
		<description>We have made use of this PeopleSoft SQR quirk for as long as I have been coding SQRs.
We always put some code like this in the initialization routine:
  if $prcs_process_instance = &#039;&#039;
    do    
  else
    do 
  end-if

This way we can test a program under development using SQRW and then develop the run control tables and page after the SQR has been unit tested.</description>
		<content:encoded><![CDATA[<p>We have made use of this PeopleSoft SQR quirk for as long as I have been coding SQRs.<br />
We always put some code like this in the initialization routine:<br />
  if $prcs_process_instance = &#8221;<br />
    do<br />
  else<br />
    do<br />
  end-if</p>
<p>This way we can test a program under development using SQRW and then develop the run control tables and page after the SQR has been unit tested.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on 9 SQL Parameters: Load-Lookup Love Letter by summer camps san francisco</title>
		<link>http://peoplesoftsqr.com/index.php/2009/03/9-sql-parameters-load-lookup-love-letter/comment-page-1/#comment-7968</link>
		<dc:creator>summer camps san francisco</dc:creator>
		<pubDate>Fri, 23 Mar 2012 03:48:08 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=206#comment-7968</guid>
		<description>I have a store proc that runs with no parameters, goes over a wire to a linked server outside the network and builds a local global temp table of all objects inside the linked server. This proc determines changes from the table, column, and type level compared to a local server and seems to be very quick in execution. However I started to get concerned when I viewed the execution plan. The largest cost was in a Hash Mash lookup (73%). I want the best execution possible on the server side. During server down time, a job will execute this proc and rebuild any changes in the schema dynamically, but for 3 seconds it consumes almost 50% of CPU resources on Vitrual server with a 2 Ghz Quad Processor and 3 Gigs of Ram allocated. This concerns me since the record count is about 2300+ rows and I still haven&#039;t imported the data. Besides upgrading the server or modifying allocation, is there any tricks to balance the load? I have looked into multiple solutions and still face the same load issue.</description>
		<content:encoded><![CDATA[<p>I have a store proc that runs with no parameters, goes over a wire to a linked server outside the network and builds a local global temp table of all objects inside the linked server. This proc determines changes from the table, column, and type level compared to a local server and seems to be very quick in execution. However I started to get concerned when I viewed the execution plan. The largest cost was in a Hash Mash lookup (73%). I want the best execution possible on the server side. During server down time, a job will execute this proc and rebuild any changes in the schema dynamically, but for 3 seconds it consumes almost 50% of CPU resources on Vitrual server with a 2 Ghz Quad Processor and 3 Gigs of Ram allocated. This concerns me since the record count is about 2300+ rows and I still haven&#8217;t imported the data. Besides upgrading the server or modifying allocation, is there any tricks to balance the load? I have looked into multiple solutions and still face the same load issue.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on About by Geoffrey</title>
		<link>http://peoplesoftsqr.com/index.php/about/comment-page-1/#comment-7884</link>
		<dc:creator>Geoffrey</dc:creator>
		<pubDate>Thu, 08 Mar 2012 00:44:35 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/wordpress/?page_id=2#comment-7884</guid>
		<description>Hi there,

Came upon your website and perhaps you can offer some assitance. When we upgraded a while back from PeopleSoft v8.8 to v9, we also upgraded SQL Server to 2008. Part of this was to update selected SQR programs that utilize outer joins.  Most of them I could deal with however it seems that SQR programs fail when they have bind variable(s) in the outer join portion.  The identical statement runs just fine in our Query Analyzer tool when I replace the bind variables:

begin-SELECT
CT.WRKDAY_ID
CT.DUR
P.TRC
P.TL_QUANTITY
FROM PS_SCH_CLND_VW CT LEFT OUTER JOIN PS_TL_RPTD_TIME AS P ON P.DUR = CT.DUR AND P.EMPLID = &amp;_J.EMPLID AND P.EMPL_RCD = &amp;_J.EMPL_RCD AND P.TRC = $Sck_Cd
WHERE CT.SCHEDULE_ID = &amp;WT.SCHEDULE_ID
  AND CT.DUR BETWEEN $Q_Begin AND $Q_End
ORDER BY CT.DUR DESC
end-SELECT

This is what I get in the log file:
(SQR 1303) Error in SQL (perhaps missing &amp;name after expression):
SELECT CT.WRKDAY_ID, CT.DUR, P.TRC, P.TL_QUANTITY  FROM PS_SCH_CLND_VW CT LEFT OUTER JOIN PS_TL_RPTD_TIME AS P ON P.DUR = CT.DUR AND P.EMPLID = ? AND P.EMPL_RCD = ? AND P.TRC = ? WHERE CT.SCHEDULE_ID = ? AND CT.DUR BETWEEN ? AND ? ORDER BY CT.DUR DESC 
(SQR 1304) Check SELECT columns, expressions and &#039;where&#039; clause for syntax.

SQR for PeopleSoft: Program Aborting.

This is executed within a local procedure. That said, the old way of doing the outer join used the variables and *= . This worked fine.

In Query Analyzer with the bind variables replaced:
SELECT
CT.WRKDAY_ID,
CT.DUR,
P.TRC,
P.TL_QUANTITY
FROM PS_SCH_CLND_VW CT LEFT OUTER JOIN PS_TL_RPTD_TIME AS P ON P.DUR = CT.DUR AND P.EMPLID = &#039;0717&#039; AND P.EMPL_RCD = 0 AND P.TRC = &#039;PS1&#039;
WHERE CT.SCHEDULE_ID = &#039;STNDFIREB&#039;
  AND CT.DUR BETWEEN &#039;2012-02-06&#039; AND &#039;2012-02-20&#039;
ORDER BY CT.DUR DESC

Yields:

OFF	         2012-02-20 00:00:00.000     NULL     NULL
OFF	         2012-02-19 00:00:00.000     NULL     NULL
OFF	         2012-02-18 00:00:00.000     NULL     NULL
OFF	         2012-02-17 00:00:00.000	NULL     NULL
WRKDAY14HR	2012-02-16 00:00:00.000	PS1	14.000000
WRKDAY14HR	2012-02-15 00:00:00.000	PS1	14.000000
WRKDAY10HR	2012-02-14 00:00:00.000	PS1	10.000000
WRKDAY10HR	2012-02-13 00:00:00.000	PS1	10.000000
OFF	         2012-02-12 00:00:00.000	NULL	NULL
OFF	         2012-02-11 00:00:00.000	NULL	NULL
OFF	         2012-02-10 00:00:00.000	NULL	NULL
OFF	         2012-02-09 00:00:00.000	NULL	NULL
WRKDAY14HR	2012-02-08 00:00:00.000	PS1	14.000000
WRKDAY14HR	2012-02-07 00:00:00.000	PS1	14.000000
WRKDAY10HR	2012-02-06 00:00:00.000	NULL	NULL

Thx,
Geoffrey</description>
		<content:encoded><![CDATA[<p>Hi there,</p>
<p>Came upon your website and perhaps you can offer some assitance. When we upgraded a while back from PeopleSoft v8.8 to v9, we also upgraded SQL Server to 2008. Part of this was to update selected SQR programs that utilize outer joins.  Most of them I could deal with however it seems that SQR programs fail when they have bind variable(s) in the outer join portion.  The identical statement runs just fine in our Query Analyzer tool when I replace the bind variables:</p>
<p>begin-SELECT<br />
CT.WRKDAY_ID<br />
CT.DUR<br />
P.TRC<br />
P.TL_QUANTITY<br />
FROM PS_SCH_CLND_VW CT LEFT OUTER JOIN PS_TL_RPTD_TIME AS P ON P.DUR = CT.DUR AND P.EMPLID = &amp;_J.EMPLID AND P.EMPL_RCD = &amp;_J.EMPL_RCD AND P.TRC = $Sck_Cd<br />
WHERE CT.SCHEDULE_ID = &amp;WT.SCHEDULE_ID<br />
  AND CT.DUR BETWEEN $Q_Begin AND $Q_End<br />
ORDER BY CT.DUR DESC<br />
end-SELECT</p>
<p>This is what I get in the log file:<br />
(SQR 1303) Error in SQL (perhaps missing &amp;name after expression):<br />
SELECT CT.WRKDAY_ID, CT.DUR, P.TRC, P.TL_QUANTITY  FROM PS_SCH_CLND_VW CT LEFT OUTER JOIN PS_TL_RPTD_TIME AS P ON P.DUR = CT.DUR AND P.EMPLID = ? AND P.EMPL_RCD = ? AND P.TRC = ? WHERE CT.SCHEDULE_ID = ? AND CT.DUR BETWEEN ? AND ? ORDER BY CT.DUR DESC<br />
(SQR 1304) Check SELECT columns, expressions and &#8216;where&#8217; clause for syntax.</p>
<p>SQR for PeopleSoft: Program Aborting.</p>
<p>This is executed within a local procedure. That said, the old way of doing the outer join used the variables and *= . This worked fine.</p>
<p>In Query Analyzer with the bind variables replaced:<br />
SELECT<br />
CT.WRKDAY_ID,<br />
CT.DUR,<br />
P.TRC,<br />
P.TL_QUANTITY<br />
FROM PS_SCH_CLND_VW CT LEFT OUTER JOIN PS_TL_RPTD_TIME AS P ON P.DUR = CT.DUR AND P.EMPLID = &#8216;0717&#8242; AND P.EMPL_RCD = 0 AND P.TRC = &#8216;PS1&#8242;<br />
WHERE CT.SCHEDULE_ID = &#8216;STNDFIREB&#8217;<br />
  AND CT.DUR BETWEEN &#8216;2012-02-06&#8242; AND &#8216;2012-02-20&#8242;<br />
ORDER BY CT.DUR DESC</p>
<p>Yields:</p>
<p>OFF	         2012-02-20 00:00:00.000     NULL     NULL<br />
OFF	         2012-02-19 00:00:00.000     NULL     NULL<br />
OFF	         2012-02-18 00:00:00.000     NULL     NULL<br />
OFF	         2012-02-17 00:00:00.000	NULL     NULL<br />
WRKDAY14HR	2012-02-16 00:00:00.000	PS1	14.000000<br />
WRKDAY14HR	2012-02-15 00:00:00.000	PS1	14.000000<br />
WRKDAY10HR	2012-02-14 00:00:00.000	PS1	10.000000<br />
WRKDAY10HR	2012-02-13 00:00:00.000	PS1	10.000000<br />
OFF	         2012-02-12 00:00:00.000	NULL	NULL<br />
OFF	         2012-02-11 00:00:00.000	NULL	NULL<br />
OFF	         2012-02-10 00:00:00.000	NULL	NULL<br />
OFF	         2012-02-09 00:00:00.000	NULL	NULL<br />
WRKDAY14HR	2012-02-08 00:00:00.000	PS1	14.000000<br />
WRKDAY14HR	2012-02-07 00:00:00.000	PS1	14.000000<br />
WRKDAY10HR	2012-02-06 00:00:00.000	NULL	NULL</p>
<p>Thx,<br />
Geoffrey</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQR Dates by administrator</title>
		<link>http://peoplesoftsqr.com/index.php/2009/04/sqr-dates/comment-page-1/#comment-7680</link>
		<dc:creator>administrator</dc:creator>
		<pubDate>Mon, 23 Jan 2012 21:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://peoplesoftsqr.com/?p=300#comment-7680</guid>
		<description>If you write:

let $x = datenow()

You should make sure that $x is a date variable, not a string variable.  You do that in the setup block:

begin-setup
declare variable
date $x
end-declare
end-setup

Alternately, you could write:

let $x = datetostr(datenow(), &#039;mm/dd/yyyy hh:mi:ss&#039;)

Your note indicates that this is working properly.  I assume you insert a row with the $x variable placed in a date, datetime, or string field.  The insert should work with all three field types, but you would handle the fields differently when reading them back into an SQR program.

What type of field is &amp;AUDIT_STAMP?  Since you used to_char successfully, I assume it is a date or datetime field (which is a distinction in PeopleTools, not in the Oracle database).  In that case, you can use to_char, edit, or datetostr to convert it to a string.  You would not use strtodate() - that is a function that starts with a string, and you are starting with a date.

If &amp;AUDIT_STAMP is a string, and you are storing it as a date, you may need datetostr() to format a string to output that date.</description>
		<content:encoded><![CDATA[<p>If you write:</p>
<p>let $x = datenow()</p>
<p>You should make sure that $x is a date variable, not a string variable.  You do that in the setup block:</p>
<p>begin-setup<br />
declare variable<br />
date $x<br />
end-declare<br />
end-setup</p>
<p>Alternately, you could write:</p>
<p>let $x = datetostr(datenow(), &#8216;mm/dd/yyyy hh:mi:ss&#8217;)</p>
<p>Your note indicates that this is working properly.  I assume you insert a row with the $x variable placed in a date, datetime, or string field.  The insert should work with all three field types, but you would handle the fields differently when reading them back into an SQR program.</p>
<p>What type of field is &#038;AUDIT_STAMP?  Since you used to_char successfully, I assume it is a date or datetime field (which is a distinction in PeopleTools, not in the Oracle database).  In that case, you can use to_char, edit, or datetostr to convert it to a string.  You would not use strtodate() &#8211; that is a function that starts with a string, and you are starting with a date.</p>
<p>If &#038;AUDIT_STAMP is a string, and you are storing it as a date, you may need datetostr() to format a string to output that date.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

